fix: allow Forgejo bot actor on non-comment events
The self-trigger guard blocked the claude bot on all events. Loop risk only exists for comment/review events (tag mode). PR, workflow_dispatch, and schedule events are safe — refined the guard to only block on issue_comment, issues, pull_request_review, and pull_request_review_comment events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
307af41a7f
commit
c97c9765c3
2 files changed
+58
-5
No files matched your search
@@ -205,5 +205,41 @@ describe("checkHumanActor", () => {
|
||||
"Blocking self-trigger on Forgejo",
|
||||
);
|
||||
});
|
||||
|
||||
test("should allow bot actor on pull_request events (no loop risk)", async () => {
|
||||
const mockOctokit = createMockOctokit("User");
|
||||
const context = createMockContext();
|
||||
context.actor = "claude";
|
||||
context.inputs.botName = "claude[bot]";
|
||||
(context as { eventName: string }).eventName = "pull_request";
|
||||
|
||||
await expect(
|
||||
checkHumanActor(mockOctokit, context),
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
test("should allow bot actor on workflow_dispatch events (no loop risk)", async () => {
|
||||
const mockOctokit = createMockOctokit("User");
|
||||
const context = createMockContext();
|
||||
context.actor = "claude";
|
||||
context.inputs.botName = "claude[bot]";
|
||||
(context as { eventName: string }).eventName = "workflow_dispatch";
|
||||
|
||||
await expect(
|
||||
checkHumanActor(mockOctokit, context),
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
test("should block bot actor on issue_comment events (loop risk)", async () => {
|
||||
const mockOctokit = createMockOctokit("User");
|
||||
const context = createMockContext();
|
||||
context.actor = "claude";
|
||||
context.inputs.botName = "claude[bot]";
|
||||
// eventName defaults to "issue_comment" from createMockContext
|
||||
|
||||
await expect(checkHumanActor(mockOctokit, context)).rejects.toThrow(
|
||||
"Blocking self-trigger on Forgejo",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user