Only count reviews made against the current head commit#1
Merged
Conversation
Approvals and change requests are now counted only when submitted against the current head commit. Reviews that pre-date the latest push are treated as stale and ignored, mirroring GitHub's own stale-review behaviour. This stops a re-added ready-for-review label from being removed by reviews that the author has already addressed with a new push. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.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.
What
Counts approvals and change requests only when the review was submitted against the current head commit of the pull request. Reviews made before the latest push are treated as stale and ignored.
Why
The engine removes the
ready-for-reviewlabel when a PR has >= 2 approvals or >= 2 change requests. Previously a reviewer'sCHANGES_REQUESTED(orAPPROVED) review kept counting even after the author pushed fixes, because re-requesting a review does not reset the existing review state.That broke the documented re-review flow: after addressing two change requests, an author pushes an update and re-adds
ready-for-reviewfor a re-review, but the next workflow trigger (e.g. an unrelated review comment, which firespull_request_review: submitted) saw the two stale change requests still at threshold and stripped the freshly-added label.GitHub does not dismiss
CHANGES_REQUESTEDreviews on push, so we replicate its stale-review semantics ourselves.How
headRefOidand each review'scommit { oid }.commit.oidmatchesheadRefOid(a null oid never matches, so it is treated as stale).Testing
Follow-up
Consumers that pin this reusable workflow by SHA (e.g. hyperlight-dev/hyperlight#1568) must bump their pin to the merge commit once this lands.