Skip to content

pr-size-label: skip fork PRs instead of failing with 403 - #13

Merged
kei-nan merged 1 commit into
mainfrom
jk-pr-size-label-skip-forks
Oct 5, 2026
Merged

kei-nan merged 1 commit into
mainfrom
jk-pr-size-label-skip-forks

Conversation

@kei-nan

@kei-nan kei-nan commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

On pull_request events from forks, GitHub gives the job a read-only GITHUB_TOKEN, whatever permissions the caller declares. Adding the size label then fails with a 403, so the labeler job fails on every fork PR. Example: RediSearch/RediSearch#11778 (log shows PullRequests: 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_target because it's the smaller change and keeps the trigger callers already use.

Rollout

Callers pin @v1. Move the v1 tag 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 label job now runs only when github.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-only GITHUB_TOKEN and 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.

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>
@kei-nan
kei-nan merged commit ab30f69 into main Oct 5, 2026
2 checks passed
@kei-nan
kei-nan deleted the jk-pr-size-label-skip-forks branch October 5, 2026 15:33
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