Skip to content

Commit 9680821

Browse files
JPeer264claude
andauthored
ci(workflow): Skip PR review reminders when already approved (#20629)
Only allow PR nudges when the PR has not yet been approved. Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent f5b30eb commit 9680821

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/pr-review-reminder.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ export default async function run({ github, context, core }) {
174174
const pendingTeams = requested.teams; // team reviewers
175175
if (pendingReviewers.length === 0 && pendingTeams.length === 0) continue;
176176

177+
// Skip if the PR already has at least one approval — no need to nudge remaining reviewers
178+
const reviews = await github.paginate(github.rest.pulls.listReviews, {
179+
owner,
180+
repo,
181+
pull_number: pr.number,
182+
per_page: 100,
183+
});
184+
const hasApproval = reviews.some(r => r.state === 'APPROVED');
185+
if (hasApproval) continue;
186+
177187
// Fetch the PR timeline to determine when each review was (last) requested
178188
const timeline = await github.paginate(github.rest.issues.listEventsForTimeline, {
179189
owner,

0 commit comments

Comments
 (0)