Skip to content

Commit d4b6d51

Browse files
tommysituclaude
andcommitted
ci(claude-review): gate review on claude-review label
Anthropic's backend refuses to issue an App token for un-gated pull_request_target on fork PRs, since that combination would let any external contributor cause the action to run with base-repo credentials. A maintainer-applied label provides the trust signal the backend requires. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fe8c28a commit d4b6d51

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@ name: Claude Code Review
22

33
on:
44
pull_request_target:
5-
types: [opened, synchronize, ready_for_review, reopened]
6-
# Optional: Only run on specific file changes
7-
# paths:
8-
# - "src/**/*.ts"
9-
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
5+
types: [labeled, synchronize, reopened, ready_for_review]
126

137
jobs:
148
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
9+
# Gate: a maintainer must add the `claude-review` label. Required because
10+
# un-gated pull_request_target on fork PRs would let any contributor cause
11+
# the action to run with base-repo credentials.
12+
if: |
13+
(github.event.action == 'labeled' && github.event.label.name == 'claude-review') ||
14+
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'claude-review'))
2015
2116
runs-on: ubuntu-latest
2217
permissions:

0 commit comments

Comments
 (0)