ci: skip claude code review for fork PRs#1952
Merged
Conversation
Fork PRs cannot authenticate with the claude-code-action because: 1. The `pull_request` event from forks does not expose repository secrets or OIDC tokens (GitHub security restriction), so both `anthropic_api_key` and the GitHub App token exchange fail. 2. Switching to `pull_request_target` (which does have access to secrets and OIDC) also does not work because Anthropic's OIDC token exchange endpoint rejects `pull_request_target` event types (anthropics/claude-code-action#713). Until the upstream action supports fork PRs, skip the review to avoid noisy CI failures on every external contribution.
Kludex
approved these changes
Jan 24, 2026
Member
|
It also failed with you... 🤔 |
Contributor
Author
ah found it, from the logs:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The Claude Code Review workflow (
claude-code-review.yml) fails on every PR from a fork, producing noisy CI failures. This has been hitting external contributions consistently — for example, PR #1948 fromskyvanguard/python-sdkand every other recent fork PR. @jlowin ran into the same issue on FastMCP as well (jlowin/fastmcp#1499).Root Cause
There are two authentication paths for
claude-code-action, and both are broken for fork PRs:pull_requesttrigger (current): GitHub does not expose repository secrets or OIDC tokens to workflows triggered by fork PRs. This meanssecrets.ANTHROPIC_API_KEYis empty and theACTIONS_ID_TOKEN_REQUEST_URLenv var is unset, so the action cannot authenticate at all. The action retries OIDC 3 times and then fails with:pull_request_targettrigger (the obvious fix): This trigger runs in the base repo context so secrets and OIDC tokens are available from GitHub. However, Anthropic's OIDC token exchange endpoint (api.anthropic.com/api/github/github-app-token-exchange) rejects OIDC tokens frompull_request_targetevents because the event type is not in their server-side allowlist (anthropics/claude-code-action#713).This is a known upstream limitation tracked across multiple issues:
Evidence
I checked the last 15 runs of the
claude-code-reviewworkflow. Every successful run was from a branch inmodelcontextprotocol/python-sdk(not a fork), and every failure was from a fork — 100% correlation.Fix
Add an
ifcondition to skip the job when the PR is from a fork. This eliminates the noisy failures until the upstream action adds fork PR support.How Has This Been Tested?
Verified that the
ifexpressiongithub.event.pull_request.head.repo.fork == falseis the standard GitHub Actions pattern for detecting fork PRs. Confirmed the workflow YAML is syntactically valid via pre-commit hooks.Breaking Changes
None. The claude code review was already non-functional for fork PRs (always errored out), so this just makes the failure silent rather than red.
Types of changes
Checklist
Additional context
Once the upstream
claude-code-actionsupports fork PRs (likely by addingpull_request_targetto their OIDC allowlist), this condition can be removed.AI Disclaimer