Repository navigation
pr-size-label: skip fork PRs instead of failing with 403 - #13
Merged
Merged
Conversation
On pull_request events from forks GitHub issues a read-only GITHUB_TOKEN regardless of the declared permissions, so the labeler's API call 403s and the job fails. Skip the job for fork PRs; a skipped job counts as passing for required checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
On
pull_requestevents from forks, GitHub gives the job a read-onlyGITHUB_TOKEN, whatever permissions the caller declares. Adding the size label then fails with a 403, so thelabelerjob fails on every fork PR. Example: RediSearch/RediSearch#11778 (log showsPullRequests: read→curl: (22) ... 403). Same-repo PRs aren't affected.Change
Add a job-level
if:that runs the labeler only when the PR head repo is the base repo. On fork PRs the job is skipped. A skipped job counts as passing for required checks, and the PR just doesn't get a size label.I chose this over
pull_request_targetbecause it's the smaller change and keeps the trigger callers already use.Rollout
Callers pin
@v1. Move thev1tag to this commit after merge so they pick up the fix.🤖 Generated with Claude Code
Note
Low Risk
Single workflow guard with no auth or application logic changes; fork PRs lose automatic size labels only.
Overview
Fork PRs no longer fail the reusable PR size label workflow. The
labeljob now runs only whengithub.event.pull_request.head.repo.full_name == github.repository, so same-repo PRs still get size labels while fork PRs skip labeling instead of hitting a read-onlyGITHUB_TOKENand failing with 403.Required checks still pass on fork PRs (skipped job); those PRs simply won't receive a size label.
Reviewed by Cursor Bugbot for commit 34a82a3. Bugbot is set up for automated code reviews on this repo. Configure here.