Skip to content

ci: skip Claude review on fork PRs instead of failing - #28

Merged
duanyiqun merged 1 commit into
mainfrom
fix/claude-review-skip-forks
Jun 21, 2026
Merged

ci: skip Claude review on fork PRs instead of failing#28
duanyiqun merged 1 commit into
mainfrom
fix/claude-review-skip-forks

Conversation

@duanyiqun

Copy link
Copy Markdown
Contributor

Problem

The label-gated claude-review job fails whenever the claude-review label is applied to a fork PR (e.g. #27 from `wsl2000`'s fork). GitHub deliberately withholds secrets and the OIDC token from fork-originated `pull_request` events, so the action receives an empty `CLAUDE_CODE_OAUTH_TOKEN` and errors with:

Unable to get ACTIONS_ID_TOKEN_REQUEST_URL
Could not fetch an OIDC token. Did you remember to add `id-token: write`...

Same-repo PRs (#23–26) review fine — only forks break.

Fix

Guard the job with a same-repo condition so labeling a fork PR is a clean no-op (skipped, neutral) rather than a guaranteed red failure:

if: >-
  github.event.label.name == 'claude-review' &&
  github.event.pull_request.head.repo.full_name == github.repository
  • ✅ Same-repo PR + claude-review label → review runs as before
  • ✅ Fork PR + claude-review label → job skipped, no red X
  • 🔒 No security change (does not switch to pull_request_target)

Fork PRs can still be reviewed by pushing the branch to the main repo (collaborators have push access) and labeling there.

🤖 Generated with Claude Code

The label-gated review job failed whenever the 'claude-review' label was
applied to a fork PR (e.g. #27): GitHub withholds secrets and the OIDC
token from fork-originated pull_request events, so the action gets an empty
CLAUDE_CODE_OAUTH_TOKEN and 'Unable to get ACTIONS_ID_TOKEN_REQUEST_URL'.

Guard the job to same-repo PRs so labeling a fork is a clean no-op (skipped,
neutral) rather than a red-flagged failure. Same-repo PRs are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@duanyiqun
duanyiqun requested a review from wsuli615 June 21, 2026 04:36
@duanyiqun
duanyiqun merged commit 72d5448 into main Jun 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant