Uh oh!
There was an error while loading. Please reload this page.
fix(ci): don't skip fork-PR label reconciliation on schedule/workflow_dispatch runs - #234
Conversation
No code issues outstanding; 1 check still pending. See task
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
edelauna
commented
May 21, 2026
@roomote can you review |
I started a PR review task for this request. See task |
Uh oh!
There was an error while loading. Please reload this page.
Addressed the latest follow-up review comment in 0755fa5. Fallback truncation now derives its candidate indices from the same effective-history filtering used for provider requests, including fresh-start cleanup of orphan Validation:
The code review item is fixed; GitHub checks are still running. |
Uh oh!
There was an error while loading. Please reload this page.
0755fa5 to
2752d15CompareUh oh!
There was an error while loading. Please reload this page.
What problem this solves
label-pr-review-state.yml'sreconcileLabels()skipped label mutations for any fork PR, regardless of what triggered the workflow run. That was overly broad: onlypull_request/pull_request_reviewruns triggered from a fork actually get a read-onlyGITHUB_TOKEN(which 403s on label writes). The hourlyschedulecron and manualworkflow_dispatchruns always execute in the base repo's context with a full read/write token, even when the PR they're reconciling happens to come from a fork.As written, this meant stale
awaiting-author/awaiting-review/stale-awaiting-authorlabels on fork PRs would never get cleaned up by the scheduled reconciliation pass — only PR-triggered events could skip them, and those were exactly the runs that couldn't write labels anyway.Why this change was made
Added
isReadOnlyRun, which checks whether this run's own trigger (context.payload.pull_request) is itself a fork PR — true only forpull_request/pull_request_reviewevents fired from a fork.reconcileLabelsnow skips a PR's label mutation only when bothisReadOnlyRun && isForkPR(pr)are true, soschedule/workflow_dispatchruns reconcile fork PRs normally, while PR-triggered runs on a fork's own PR still avoid the guaranteed 403.Verified against GitHub's documented
GITHUB_TOKENpermission model (read/write forschedule/workflow_dispatch, read-only only for fork-triggeredpull_request), and validated the updated skip logic against all six realistic trigger/PR-origin combinations.User impact
Fork PRs now get their review-state labels correctly reconciled by the hourly schedule and manual dispatch runs, instead of silently never receiving label cleanup.