Repository navigation
Show whether a PR is approved in git pr - #235
Merged
Merged
Conversation
An open PR that was not approved printed "Ready". It now prints "Review required" when the base branch requires an approval, and "Not approved" when it requires none. Without a review decision, the status comes from each reviewer's last approval, change request, or dismissal, so a comment after an approval no longer hides it. Claude-Session: https://claude.ai/code/session_01FLq8eNPjDPRau2RPMnVDTj
There was a problem hiding this comment.
🟢 Approval recommended
The status logic is consistent across bundled copies and covers the relevant review-state transitions with focused tests.
0 open findings
What changed in this PR
Updates git pr to report accurate review states for open pull requests and stacked PRs.
Changes:
- Adds
Review requiredandNot approvedstatuses. - Derives fallback status from each reviewer’s latest meaningful review.
- Expands coverage for review transitions and stack output.
| File | Description |
|---|---|
bin/git-pr |
Implements improved review-status calculation. |
bin/lib/test-git-pr.sh |
Tests status mapping and review transitions. |
ai/skills/wait-for-pr-reviews/scripts/git-pr |
Synchronizes the portable helper. |
ai/skills/address-pr-reviews/scripts/git-pr |
Synchronizes the portable helper. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
git prprintedReadyfor every open PR that wasn't approved, so its output couldn't tell you whether a PR was approved. In a repo that requires no reviews, a PR whose reviewer approved and then left a comment also read as not approved, because the fallback readlatestReviews, which keeps each reviewer's newest review of any kind.An open, non-draft PR now shows
Approved,Changes requested,Review required(the base branch requires an approval the PR lacks), orNot approved(the base branch requires none and no approval counts). Stack lines use the same labels.When GitHub gives no review decision, the status comes from
reviews: each reviewer's last approval, change request, or dismissal. GraphQL'slatestOpinionatedReviewsanswers this directly, butgh --jsondoesn't expose it, and switching the lookups togh api graphqlwould rewrite most of the script.reviewsreturns every review, so a lookup on a branch name that many forks share got slower: 1.5s to 2.05s for one that matched 13 fork PRs.gh pr listalso returns only a PR's oldest 100 reviews, so in a repo that requires no reviews, an approval after the first 100 doesn't count.gh pr viewpages through all of them.Test plan
bin/lib/test-git-pr.shpasses 113 cases, including an approval followed by a comment, a change request followed by an approval, and pending and dismissed reviews after an approvalai/bin/sync-portable-skills.sh --checkpassReview requiredfor posthog PRs awaiting review,Not approvedfor an unreviewed haacked.com PR, andApprovedfor two PRs whose reviewer approved and then commentedhttps://claude.ai/code/session_01FLq8eNPjDPRau2RPMnVDTj