From df6a9a739db569cb11f2a57aa15035067b95ba77 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 5 Nov 2025 09:03:28 +0100 Subject: [PATCH] ci/github-script/bot: disregard bot and ghost approvals We technically counted bot approvals and approvals by deleted users for the approval labels as well. The former don't exist, yet, but if they were, I don't think we'd count them. The latter should arguably *not* be counted, because we can't tell anymore *who* approved, so we can't put any weight on it as reviewers. This simplifies the logic, too. --- ci/github-script/bot.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index 654ca84d2367..438ed08d9a78 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -209,10 +209,16 @@ module.exports = async ({ github, context, core, dry }) => { } } - const reviews = await github.paginate(github.rest.pulls.listReviews, { - ...context.repo, - pull_number, - }) + // Check for any human reviews other than GitHub actions and other GitHub apps. + // Accounts could be deleted as well, so don't count them. + const reviews = ( + await github.paginate(github.rest.pulls.listReviews, { + ...context.repo, + pull_number, + }) + ).filter( + (r) => r.user && !r.user.login.endsWith('[bot]') && r.user.type !== 'Bot', + ) const approvals = new Set( reviews @@ -282,13 +288,6 @@ module.exports = async ({ github, context, core, dry }) => { log('Last eval run', run_id ?? '') if (conclusion === 'success') { - // Check for any human reviews other than GitHub actions and other GitHub apps. - // Accounts could be deleted as well, so don't count them. - const humanReviews = reviews.filter( - (r) => - r.user && !r.user.login.endsWith('[bot]') && r.user.type !== 'Bot', - ) - Object.assign(prLabels, { // We only set this label if the latest eval run was successful, because if it was not, it // *could* have requested reviewers. We will let the PR author fix CI first, before "escalating" @@ -301,7 +300,7 @@ module.exports = async ({ github, context, core, dry }) => { '9.needs: reviewer': !pull_request.draft && pull_request.requested_reviewers.length === 0 && - humanReviews.length === 0, + reviews.length === 0, }) }