From 0ecc130b0ecb6a500f470119fa4781f79d785bd3 Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Tue, 22 Sep 2026 20:32:37 -0400 Subject: [PATCH] ci/github-script/bot: label PRs for unmaintained packages (cherry picked from commit db2eedfcba5911e3f98edc26157c979f3c04fbad) --- ci/github-script/bot.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index e262a7082cc5..efb5f4935aa8 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -465,9 +465,10 @@ export default async ({ github, context, core, dry }) => { let owners = [] try { // TODO: Create owner map similar to maintainer map. - owners = (await readFile(`${pull_number}/owners.txt`, 'utf-8')).split( - '\n', - ) + owners = + (await readFile(`${pull_number}/owners.txt`, 'utf-8')).match( + /[^\n]+/g, + ) || [] } catch (e) { // Older artifacts don't have the owners.txt, yet. if (e.code !== 'ENOENT') throw e @@ -483,6 +484,18 @@ export default async ({ github, context, core, dry }) => { if (e.code !== 'ENOENT') throw e } + // TODO: Use maintainer map instead of the artifact. + const user_maintainers = Object.keys( + JSON.parse( + await readFile(`${pull_number}/maintainers.json`, 'utf-8'), + ), + ).map((id) => parseInt(id)) + + prLabels['7.unmaintained'] = + user_maintainers.length === 0 && + team_maintainers.length === 0 && + owners.length === 0 + // 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 // this label from flip-flopping. @@ -494,12 +507,7 @@ export default async ({ github, context, core, dry }) => { dry, pull_request, reviews, - // TODO: Use maintainer map instead of the artifact. - user_maintainers: Object.keys( - JSON.parse( - await readFile(`${pull_number}/maintainers.json`, 'utf-8'), - ), - ).map((id) => parseInt(id)), + user_maintainers, team_maintainers, owners, getUser,