Skip to content

Commit c044b5d

Browse files
cliffhallclaude
andcommitted
ci: gate claude.yml on author_association to skip unauthorized invokes
Previously the workflow's `if:` only checked the event type and the presence of `@claude` in the body. The job would start for any commenter and only later fail when the action attempted privileged operations on behalf of a user without write access. That produced noisy red runs and wasted runner minutes for what is effectively an authorization rejection. Add an `author_association` check (OWNER, MEMBER, or COLLABORATOR) to each of the four trigger branches (issue_comment, pull_request_review_comment, pull_request_review, issues), so the job is short-circuited at workflow evaluation time and never starts for unauthorized invokers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent adfcccc commit c044b5d

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/claude.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,26 @@ jobs:
1414
claude:
1515
if: |
1616
(
17-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
19-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
20-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
17+
(github.event_name == 'issue_comment' &&
18+
contains(github.event.comment.body, '@claude') &&
19+
(github.event.comment.author_association == 'OWNER' ||
20+
github.event.comment.author_association == 'MEMBER' ||
21+
github.event.comment.author_association == 'COLLABORATOR')) ||
22+
(github.event_name == 'pull_request_review_comment' &&
23+
contains(github.event.comment.body, '@claude') &&
24+
(github.event.comment.author_association == 'OWNER' ||
25+
github.event.comment.author_association == 'MEMBER' ||
26+
github.event.comment.author_association == 'COLLABORATOR')) ||
27+
(github.event_name == 'pull_request_review' &&
28+
contains(github.event.review.body, '@claude') &&
29+
(github.event.review.author_association == 'OWNER' ||
30+
github.event.review.author_association == 'MEMBER' ||
31+
github.event.review.author_association == 'COLLABORATOR')) ||
32+
(github.event_name == 'issues' &&
33+
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
34+
(github.event.issue.author_association == 'OWNER' ||
35+
github.event.issue.author_association == 'MEMBER' ||
36+
github.event.issue.author_association == 'COLLABORATOR'))
2137
)
2238
runs-on: ubuntu-latest
2339
permissions:

0 commit comments

Comments
 (0)