Add comprehensive fork PR support documentation and examples#614
Open
keithah wants to merge 1 commit intoanthropics:mainfrom
Open
Add comprehensive fork PR support documentation and examples#614keithah wants to merge 1 commit intoanthropics:mainfrom
keithah wants to merge 1 commit intoanthropics:mainfrom
Conversation
This PR addresses multiple open issues related to fork PR support: - anthropics#339 - Claude review fails on PRs from forks - anthropics#542 - OIDC token errors on fork PRs - anthropics#223 - "couldn't find remote ref" errors for fork PRs - anthropics#46 - Wrong branch checkout for forked PRs ## Changes ### Documentation - **New**: `docs/fork-pr-support.md` - Comprehensive guide covering: - Both @claude mention and automated review scenarios - Step-by-step solutions with explanations - Security considerations for pull_request_target - Complete working examples - Troubleshooting guide - Migration instructions - **Updated**: `docs/faq.md` - Added fork PR section with: - Common fork PR errors and solutions - Links to detailed fork PR support guide ### Example Workflows All PR review examples updated to support fork PRs: - **`examples/claude.yml`** - Added fork detection for @claude mentions: - Dynamically detects fork PRs via GitHub API - Checks out fork repository when needed - Works for both fork and non-fork PRs - **`examples/pr-review-comprehensive.yml`** - Updated for automated reviews: - Changed to `pull_request_target` trigger - Checkouts fork repository correctly - Added `github_token` to bypass OIDC issues - Added `allowed_non_write_users: '*'` for fork contributors - **`examples/pr-review-filtered-authors.yml`** - Same fork PR fixes - **`examples/pr-review-filtered-paths.yml`** - Same fork PR fixes ## Key Fixes ### Fix 1: @claude Mentions on Fork PRs Fork branches don't exist in base repo, so we detect forks and checkout fork repository directly using `actions/checkout` with dynamic repository parameter. ### Fix 2: Automated Reviews on Fork PRs Requires three changes: 1. Checkout fork repository: `repository: ${{ github.event.pull_request.head.repo.full_name }}` 2. Bypass OIDC: `github_token: ${{ secrets.GITHUB_TOKEN }}` 3. Allow fork contributors: `allowed_non_write_users: '*'` ## Credits Special thanks to @CryptoGnome whose aster_lick_hunter_node repository provided valuable insights for the fork repository checkout solution. ## Testing Successfully tested on xbmc/xbmc repository: - @claude mentions working on fork PRs - Automated reviews working on fork PRs from users without write access - Example: xbmc/xbmc#27339 (comment)
|
Any news on this? |
yangm2
added a commit
to yangm2/tenantfirstaid
that referenced
this pull request
Nov 11, 2025
yangm2
added a commit
to yangm2/tenantfirstaid
that referenced
this pull request
Nov 12, 2025
yangm2
added a commit
to codeforpdx/tenantfirstaid
that referenced
this pull request
Nov 18, 2025
* switch to Claude agent v1 with more project configuration * add an Infrastructure category * try fix from anthropics/claude-code-action#614 * um not sure if this will help * broken due to some comment permission issue ... defer * fix typo * stay on Python 3.13 for now; don't build dependencies * allow dependency builds * try applying fork support fixes again
dirvine
added a commit
to saorsa-labs/saorsa-node
that referenced
this pull request
Jan 28, 2026
The official claude-code-action@v1 has a bug (#223) where it fails to checkout PRs from forks. PR #614 fixes this but isn't merged yet. Using keithah/claude-code-action@fork-pr-support as a temporary workaround until the fix is merged into the main action. Refs: - anthropics/claude-code-action#223 - anthropics/claude-code-action#614 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
DouweM
added a commit
to pydantic/pydantic-ai
that referenced
this pull request
Feb 5, 2026
- review.yml: Switch to pull_request_target trigger, checkout fork repo explicitly, use github_token to bypass OIDC, allow non-write users, remove make install (don't run untrusted code), block make/uv tools - at-claude.yml: Add maintainer-only gate via author_association, add fork PR detection and checkout, upgrade actions/checkout to v6 Based on approach from anthropics/claude-code-action#614. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kodiakhq bot
pushed a commit
to hyperdxio/hyperdx
that referenced
this pull request
Feb 19, 2026
Known limitation from the official workflow. See anthropics/claude-code-action#614 for inspiration for this change.
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.
This PR addresses multiple open issues related to fork PR support:
Summary
Fork PRs have been a persistent pain point for users. This PR provides comprehensive documentation and updated examples to make fork PR support work seamlessly for both @claude mentions and automated reviews.
Changes
📚 Documentation
New:
docs/fork-pr-support.mdComprehensive guide covering:
pull_request_targetpull_requestvspull_request_targetUpdated:
docs/faq.md🔧 Example Workflows
All PR review examples updated to support fork PRs:
examples/claude.yml(@claude mentions)examples/pr-review-*.yml(Automated reviews)Updated all three PR review examples:
pull_request_targettriggergithub_tokento bypass OIDC issuesallowed_non_write_users: '*'to allow fork contributorsKey Technical Fixes
Fix 1: @claude Mentions on Fork PRs
Problem: Fork branches don't exist in base repository
Solution: Detect fork PRs and checkout fork repository directly
Fix 2: Automated Reviews on Fork PRs
Problems:
pull_request_targetSolution: Apply three fixes
Security Analysis
Using
allowed_non_write_users: '*'is safe for review workflows because:pull_request_target(runs in base repo context, not fork)The documentation clearly explains when this is safe vs unsafe.
Testing
Successfully tested on xbmc/xbmc repository:
Credits
Special thanks to @CryptoGnome whose aster_lick_hunter_node repository provided valuable insights for the fork repository checkout solution.
Migration Path
Users with existing workflows can follow the migration guide in
docs/fork-pr-support.mdto add fork support. The changes are backward compatible - non-fork PRs continue to work as before.This should significantly improve the fork PR experience and close several long-standing issues! 🎉