From 687ba35b18641ed29198464b96eade05c87799d3 Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Mon, 26 Oct 2026 15:15:09 -0400 Subject: [PATCH] ci/github-script/bot: don't count PR author as a default reviewer See https://github.com/NixOS/nixpkgs/pull/567241#issuecomment-6387518337 --- ci/github-script/bot.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ci/github-script/bot.ts b/ci/github-script/bot.ts index 5ff55f666ba76..729bcb83abc57 100644 --- a/ci/github-script/bot.ts +++ b/ci/github-script/bot.ts @@ -529,10 +529,21 @@ export default async ({ ), ).map((id) => parseInt(id)) + const hasNoDefaultReviewersFrom = ( + idsOrLogins: number[] | string[], + ) => { + if (idsOrLogins.length !== 1) return idsOrLogins.length === 0 + + return typeof idsOrLogins[0] === 'number' + ? idsOrLogins[0] === pull_request.user.id + : idsOrLogins[0].toLowerCase() === + pull_request.user.login.toLowerCase() + } + prLabels['7.no default reviewers'] = - user_maintainers.length === 0 && - team_maintainers.length === 0 && - owners.length === 0 + hasNoDefaultReviewersFrom(user_maintainers) && + hasNoDefaultReviewersFrom(team_maintainers) && + hasNoDefaultReviewersFrom(owners) // We set this label earlier already, but the current PR state can be very different // after handleReviewers has requested reviews, so update it in this case to prevent