fix(ci): don't skip fork-PR label reconciliation on schedule/workflow_dispatch runs#234
Merged
Merged
Conversation
Contributor
Author
|
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! |
Contributor
|
@roomote can you review |
Contributor
Author
|
I started a PR review task for this request. See task |
Contributor
Author
|
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. |
0755fa5 to
2752d15
Compare
edelauna
approved these changes
Jul 4, 2026
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.
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.