From ed02109c0cc617a87339720ed20921a6304402e6 Mon Sep 17 00:00:00 2001 From: Joakim Pedersen Date: Thu, 5 Mar 2026 17:00:01 +0000 Subject: [PATCH] feat: support pull_request.labeled action for track_progress Add "labeled" to the supported PR actions in detectMode() and validateTrackProgressEvent(), enabling label-gated PR reviews with track_progress enabled. Fixes anthropics/claude-code-action#418 Co-Authored-By: Claude Opus 4.6 --- src/modes/detector.ts | 2 ++ test/modes/detector.test.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/modes/detector.ts b/src/modes/detector.ts index c15ce88a1..8d477b9cc 100644 --- a/src/modes/detector.ts +++ b/src/modes/detector.ts @@ -67,6 +67,7 @@ export function detectMode(context: GitHubContext): AutoDetectedMode { "synchronize", "ready_for_review", "reopened", + "labeled", ]; if (context.eventAction && supportedActions.includes(context.eventAction)) { // If prompt is provided, use agent mode (default for automation) @@ -103,6 +104,7 @@ function validateTrackProgressEvent(context: GitHubContext): void { "synchronize", "ready_for_review", "reopened", + "labeled", ]; if (!validActions.includes(context.eventAction)) { throw new Error( diff --git a/test/modes/detector.test.ts b/test/modes/detector.test.ts index c8a6c75ff..ccaf32467 100644 --- a/test/modes/detector.test.ts +++ b/test/modes/detector.test.ts @@ -61,6 +61,20 @@ describe("detectMode with enhanced routing", () => { expect(detectMode(context)).toBe("tag"); }); + it("should use tag mode when track_progress is true for pull_request.labeled", () => { + const context: GitHubContext = { + ...baseContext, + eventName: "pull_request", + eventAction: "labeled", + payload: { pull_request: { number: 1 } } as any, + entityNumber: 1, + isPR: true, + inputs: { ...baseContext.inputs, trackProgress: true }, + }; + + expect(detectMode(context)).toBe("tag"); + }); + it("should use agent mode when track_progress is false for pull_request.opened", () => { const context: GitHubContext = { ...baseContext,