From c768b4243eacf2a965338fe7f4fbdaf7f83d931d Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 3 Nov 2025 19:28:43 +0100 Subject: [PATCH] ci/github-script/bot: fix infinite labeling cycle When we recently refactored the code to use the maintainer map for related labels, we made a mistake: When a PR has no packages with maintainers returned from eval, the label would internally be set to `0` instead of `false`. The code would then go on compare the before and after labels with strict equality - and assume a difference, because `0 !== false`. Thus, it seemed like new labels needed to be set, so the PUT request was actually sent. Of course, the labels were actually the same - when filtering the labels to be set, the `0` would also be treated as falsy, so the label would not be set. This would result in no visible change in the PR, but internall GitHub would replace the `updated_at` timestamp for that PR - after all we replaced all labels. Repeatedly updating *all* PRs we're looking at quickly causes problems, because we are going to look at the same PRs *again* in the next cycle - essentially causing infinite recursion. The bot became slower and slower over time, because it had to process more and more PRs each run. Simply casting this to a proper Boolean, should get us out of the mess soon. --- ci/github-script/bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index a40b3b227957..fb5e79e54239 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -322,7 +322,7 @@ module.exports = async ({ github, context, core, dry }) => { Object.assign(prLabels, evalLabels, { '11.by: package-maintainer': - packages.length && + Boolean(packages.length) && packages.every((pkg) => maintainers[pkg]?.includes(pull_request.user.id), ),