11name : Claude Code
22
3+ # Only triggers that carry comment bodies worth @claude-scanning.
4+ # pull_request_review is excluded: it fires on every review submit (even bare
5+ # approvals), so the @claude filter would show a "Skipped" check in the PR jobs
6+ # list every time. Inline review comments still fire through
7+ # pull_request_review_comment, so we don't lose the typical reviewer flow.
38on :
49 issue_comment :
510 types : [created]
611 pull_request_review_comment :
712 types : [created]
813 issues :
914 types : [opened, assigned]
10- pull_request_review :
11- types : [submitted]
1215
16+ # For PR review events (where head.ref is available), share the branch queue
17+ # with claude-improvement and claude-healing so we never push concurrently to
18+ # the same head. For issue_comment / issues events, fall back to a per-issue
19+ # key — can't resolve the branch at concurrency-evaluation time without an API
20+ # call, but at least successive @claude comments on one PR/issue serialize.
1321concurrency :
14- group : claude-comments -${{ github.event.issue.number || github.event. pull_request.number }}-${{ github.event.comment.id || github.event.review.id || github.run_id }}
22+ group : claude-pr -${{ github.event.pull_request.head.ref || github.event.issue.number || github.run_id }}
1523 cancel-in-progress : false
1624
1725jobs :
1826 claude :
27+ # Gate on author association: Claude runs with --dangerously-skip-permissions
28+ # and contents: write, so user-controlled prompt content from untrusted
29+ # commenters would be a prompt-injection vector. Only trusted associations
30+ # (repo owner, org member, collaborator) can invoke @claude.
1931 if : |
20- (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
21- (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
22- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
23- (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
32+ (
33+ github.event.comment.author_association == 'OWNER' ||
34+ github.event.comment.author_association == 'MEMBER' ||
35+ github.event.comment.author_association == 'COLLABORATOR' ||
36+ github.event.issue.author_association == 'OWNER' ||
37+ github.event.issue.author_association == 'MEMBER' ||
38+ github.event.issue.author_association == 'COLLABORATOR'
39+ ) && (
40+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
41+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
42+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
43+ )
2444 runs-on : ubuntu-latest
2545 permissions :
2646 contents : write
2949 id-token : write
3050 actions : read
3151 steps :
52+ - name : Resolve PR head ref
53+ id : ref
54+ env :
55+ GH_TOKEN : ${{ github.token }}
56+ REPO : ${{ github.repository }}
57+ PR_HEAD_REF : ${{ github.event.pull_request.head.ref }}
58+ ISSUE_PR_URL : ${{ github.event.issue.pull_request.url }}
59+ ISSUE_NUMBER : ${{ github.event.issue.number }}
60+ run : |
61+ # pull_request_review* events expose head.ref directly.
62+ # issue_comment events on a PR expose issue.pull_request.url; resolve
63+ # the branch via gh. Plain issues have neither → stay on default branch.
64+ if [[ -n "$PR_HEAD_REF" ]]; then
65+ ref="$PR_HEAD_REF"
66+ elif [[ -n "$ISSUE_PR_URL" ]]; then
67+ ref=$(gh pr view "$ISSUE_NUMBER" --repo "$REPO" --json headRefName --jq .headRefName)
68+ else
69+ ref=""
70+ fi
71+ echo "ref=$ref" >> "$GITHUB_OUTPUT"
72+ echo "Resolved checkout ref: '${ref:-<default branch>}'"
73+
3274 - name : Checkout repository
33- uses : actions/checkout@v6
75+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3476 with :
77+ ref : ${{ steps.ref.outputs.ref }}
3578 fetch-depth : 20
3679
3780 - name : Classify task complexity with Haiku
@@ -48,11 +91,11 @@ jobs:
4891 TITLE: ${{ github.event.issue.title }}
4992
5093 REQUEST:
51- ${{ github.event.comment.body || github.event.review.body || github.event. issue.body }}
94+ ${{ github.event.comment.body || github.event.issue.body }}
5295
5396 - name : Run Claude Code
5497 id : claude
55- uses : anthropics/claude-code-action@v1
98+ uses : anthropics/claude-code-action@b4d67413279fc18c6e5de930ae307c4f108714eb # v1.0.104
5699 with :
57100 claude_code_oauth_token : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
58101 plugin_marketplaces : |
0 commit comments