fix(pr-review): skip pull_request path for fork PRs (avoid read-only-token 403)#1219
Merged
Conversation
…403) #1218 added a pull_request trigger, but fork PRs run with a read-only GITHUB_TOKEN, so creating the 'OpenAB PR Review' status 403s and the run fails (observed on fork PR #1190). Guard the job to run on pull_request events only for same-repo PRs; forks continue to be handled by the cron poller (which runs with full permissions). schedule/workflow_dispatch always run. Fixes the failing runs introduced by #1218.
thepagent
approved these changes
Jun 27, 2026
Collaborator
Author
|
LGTM ✅ — Correctly guards the What This PR DoesPR #1218 added How It WorksA single job-level if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
Findings
Baseline Check
What's Good (🟢)
|
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.
Problem
#1218 added
pull_request: [opened, synchronize, reopened]topr-bot-review.yml. But fork PRs runpull_requestwith a read-onlyGITHUB_TOKEN, so the job'sPOST /statusescall returns403 Resource not accessible by integrationand the run fails.Observed immediately on fork PR #1190 (
brettchien, cross-repo): https://github.com/openabdev/openab/actions/runs/28275655386This is worse than the original 'waiting on cron' state — it's a red failing run on every fork-PR push.
Fix
Guard the job so the
pull_requestpath only runs for same-repo PRs:schedule/workflow_dispatch→ always run (full token; reviews all PRs incl. forks, as before).pull_requestfrom same-repo branch → run (token hasstatuses: write) → prompt status on rebase/push.pull_requestfrom fork → skipped (neutral, not failed); the cron poller still reviews it with full permissions.Net: keeps the #1218 speedup for same-repo PRs (the common case) while forks behave exactly as they did before #1218 (handled by cron), with no failing runs.
Verification
YAML parses; job
ifguard confirmed. No other logic changed.