mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
fix: use agent mode for issues events with explicit prompts (#530)
Fixes #528 - Issues events now correctly use agent mode when an explicit prompt is provided in the workflow YAML, matching the behavior of PR events. Previously, issues events would always use tag mode (with tracking comments) even when a prompt was provided, creating inconsistent behavior compared to pull request events which correctly used agent mode for automation. The fix adds a check for explicit prompts before checking for triggers, ensuring consistent mode selection across all event types. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,33 @@ describe("detectMode with enhanced routing", () => {
|
||||
|
||||
expect(detectMode(context)).toBe("agent");
|
||||
});
|
||||
|
||||
it("should use agent mode for issues with explicit prompt", () => {
|
||||
const context: GitHubContext = {
|
||||
...baseContext,
|
||||
eventName: "issues",
|
||||
eventAction: "opened",
|
||||
payload: { issue: { number: 1, body: "Test issue" } } as any,
|
||||
entityNumber: 1,
|
||||
isPR: false,
|
||||
inputs: { ...baseContext.inputs, prompt: "Analyze this issue" },
|
||||
};
|
||||
|
||||
expect(detectMode(context)).toBe("agent");
|
||||
});
|
||||
|
||||
it("should use tag mode for issues with @claude mention and no prompt", () => {
|
||||
const context: GitHubContext = {
|
||||
...baseContext,
|
||||
eventName: "issues",
|
||||
eventAction: "opened",
|
||||
payload: { issue: { number: 1, body: "@claude help" } } as any,
|
||||
entityNumber: 1,
|
||||
isPR: false,
|
||||
};
|
||||
|
||||
expect(detectMode(context)).toBe("tag");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Comment Events (unchanged behavior)", () => {
|
||||
|
||||
Reference in New Issue
Block a user