Skip to content

fix: exclude already-approved PRs from review digest#30

Closed
Ilia wants to merge 1 commit into
mainfrom
fix/exclude-approved-prs
Closed

fix: exclude already-approved PRs from review digest#30
Ilia wants to merge 1 commit into
mainfrom
fix/exclude-approved-prs

Conversation

@Ilia

@Ilia Ilia commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Approved PRs were showing up in the digest because GitHub clears reviewRequests once a reviewer submits — the workflow couldn't distinguish "never reviewed" from "reviewed, approved, waiting to merge"
  • Adds reviews(first: 20) { nodes { state } } to the GraphQL query
  • Adds a jq filter to exclude PRs with at least one APPROVED review

Impact: digest drops from 7 → 3 PRs (verified via dry run on this branch). The 4 excluded PRs — PACT-6602, .github #24, .github #26, and PACT-6663 — all had existing approvals and are blocked on the author merging, not on finding a reviewer.

Test plan

  • Dry run triggered from this branch — output confirmed approved PRs are excluded
  • Merge and verify next scheduled run (7:45am or 1:45pm AEST)

🤖 Generated with Claude Code

PRs with at least one APPROVED review were appearing in the digest
because reviewRequests clears once a reviewer submits — the workflow
had no way to distinguish "never reviewed" from "reviewed and approved,
waiting to be merged".

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Ilia Ilia force-pushed the fix/exclude-approved-prs branch from 6a07cdd to be579a1 Compare June 9, 2026 05:21
([.reviewRequests.nodes[] | select(.requestedReviewer.__typename == "User" or .requestedReviewer.__typename == "Team")] | length) == 0 and
(.commits.nodes[0].commit.statusCheckRollup.state == "SUCCESS")
(.commits.nodes[0].commit.statusCheckRollup.state == "SUCCESS") and
(.reviews.nodes | map(select(.state == "APPROVED")) | length) == 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work for PRs in repos configured to dismiss reviews if there's a subsequent change to the PR, which then means that the PR won't appear in the notification for re-review.

@@ -100,7 +103,8 @@ jobs:
# Bot reviewers (e.g. Copilot) are intentionally ignored — a PR with
# only a bot reviewer still needs a human to pick it up.
([.reviewRequests.nodes[] | select(.requestedReviewer.__typename == "User" or .requestedReviewer.__typename == "Team")] | length) == 0 and

@JP-Ellis JP-Ellis Jun 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't see your update in your last PR.

So for the purposes of this notification, we ignore PRs that have a human review request, but still need a review? Wouldn't it be simpler to just disregard the number of requests entirely? Afterall, the notification is just for "PR needing a review" (which would imply irrespective of how many review requests it has)

@Ilia Ilia closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants