mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
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.
This commit is contained in:
parent
56dec699a2
commit
c768b4243e
|
|
@ -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),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue