fix(review-bot): use GitHub reviewDecision as source of truth for approval - #339
Merged
Conversation
…roval pr-review-status.yml and pr-reviewer-remind.yml computed "fully approved" from a hardcoded set of tracked participants (main/second/always reviewer), so the Slack "approved" state and DM drifted from GitHub's own required review policy whenever that policy changed (e.g. min reviewers 2 -> 1). Query the PR's reviewDecision via GraphQL instead, which already folds in required_approving_review_count, code-owner rules, and dismissals. Also stops pr-reviewer-remind.yml from nagging a still-pending assigned reviewer once GitHub already considers the PR approved. Co-Authored-By: Claude Sonnet 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.
Summary
pr-review-status.yml,pr-reviewer-remind.yml) hardcoded which participants had to approve (assigned reviewer + the permanent "always reviewer"), independent of GitHub's actual branch-protection policy. Loweringrequired_approving_review_countto 1 (Lower main branch approval requirement from 2 to 1 #335/Update branch protection to remove required code-owner review #336/Update PR review bot to complete on first approval while still requesting two reviewers #337) didn't change that hardcoded gate.reviewDecision(folds in required approval count, code-owner rules, dismissals) in both workflows, so the bot tracks whatever the branch protection policy currently is without needing a matching code edit.pr-reviewer-remind.ymlnow stops nagging a still-pending assigned reviewer once GitHub already considers the PR approved.pr-reviewer-assign.yml) is untouched — still assigns the round-robin reviewer + expects the always-reviewer, unchanged.Test plan
pr-review-status.yml'sgithub.graphqlcall resolvesreviewDecisioncorrectly on a real PR (dry run viaworkflow_dispatchor a test PR)pr-reviewer-remind.ymlcron no longer sends a reminder for a PR that's alreadyreviewDecision: APPROVEDbut has a pending requested reviewer🤖 Generated with Claude Code