mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
fix: support labeled action for pull_request events in track_progress (#1586)
Adds "labeled" to the valid pull_request actions for track_progress, mirroring the existing support for issue events. Previously, adding a label to a PR (e.g. to trigger a label-driven Claude review) would fail validation even though the same pattern works for issues. Fixes #1585
This commit is contained in:
+1
-1
@@ -134,7 +134,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "claude[bot]"
|
default: "claude[bot]"
|
||||||
track_progress:
|
track_progress:
|
||||||
description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened) and issue (opened, edited, labeled, assigned) events."
|
description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened, labeled) and issue (opened, edited, labeled, assigned) events."
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
include_fix_links:
|
include_fix_links:
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ function validateTrackProgressEvent(context: GitHubContext): void {
|
|||||||
"synchronize",
|
"synchronize",
|
||||||
"ready_for_review",
|
"ready_for_review",
|
||||||
"reopened",
|
"reopened",
|
||||||
|
"labeled",
|
||||||
];
|
];
|
||||||
if (!validActions.includes(context.eventAction)) {
|
if (!validActions.includes(context.eventAction)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
@@ -76,6 +76,20 @@ describe("detectMode with enhanced routing", () => {
|
|||||||
expect(detectMode(context)).toBe("agent");
|
expect(detectMode(context)).toBe("agent");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 throw error when track_progress is used with unsupported PR action", () => {
|
it("should throw error when track_progress is used with unsupported PR action", () => {
|
||||||
const context: GitHubContext = {
|
const context: GitHubContext = {
|
||||||
...baseContext,
|
...baseContext,
|
||||||
|
|||||||
Reference in New Issue
Block a user