Skip to content

ci: skip Claude review on fork PRs - #14

Merged
trentmcnitt merged 1 commit into
mainfrom
fix/claude-review-skip-forks
May 29, 2026
Merged

ci: skip Claude review on fork PRs#14
trentmcnitt merged 1 commit into
mainfrom
fix/claude-review-skip-forks

Conversation

@trentmcnitt

Copy link
Copy Markdown
Owner

Problem

The Claude Code Review check fails on every PR from a fork (e.g. #13) with:

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

This is not a missing-permission bug (the workflow already requests id-token: write) and not the contributor's fault. GitHub deliberately withholds repository secrets and the OIDC token from fork-triggered pull_request runs as a security measure, so anthropics/claude-code-action can't authenticate and fails before it reads the diff. Same-repo PRs are unaffected (they pass).

Confirmed against the run history: the two same-repo PRs succeeded; the one fork PR (#13) failed. See upstream anthropics/claude-code-action#339 (labeled bug/p1), #542, #649.

Fix

Skip the claude-review job on fork PRs via if: github.event.pull_request.head.repo.fork == false. Fork PRs now show a neutral "skipped" check instead of a red ❌.

Fork PRs can still be reviewed on demand by commenting @claude review the changes on the PR — that fires claude.yml's issue_comment trigger, which runs in the base-repo context where secrets and OIDC are available.

Considered but rejected: pull_request_target (would auto-review forks but runs with repo secrets against untrusted code — real prompt-injection / token-minting risk per upstream security guidance).

🤖 Generated with Claude Code

Fork-triggered pull_request runs get no secrets and no OIDC token, so
the claude-code-action can't authenticate and the check fails on every
external PR (e.g. #13) through no fault of the contributor.

Skip the claude-review job on forks. Fork PRs can still be reviewed on
demand by commenting "@claude review the changes", which runs through
claude.yml's issue_comment trigger in the base-repo context where
secrets and OIDC are available.
@trentmcnitt
trentmcnitt merged commit 068867d into main May 29, 2026
1 check failed
@trentmcnitt
trentmcnitt deleted the fix/claude-review-skip-forks branch May 29, 2026 15:32
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