From e0c0b2c54c6dd2c232366a4aed6d4b01fa7755f1 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 3 Nov 2025 08:57:02 +0100 Subject: [PATCH] ci/github-script/merge: improve feedback for by-name check The by-name check would previously be green when the `pkgs/by-name/README.md` file was changed. This would still not mean the maintainer was able to merge the PR, because there'd be no maintainer for that file, but the feedback was not 100% accurate. --- ci/README.md | 2 +- ci/github-script/merge.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/README.md b/ci/README.md index 4848805baf28..81ba0499bbc2 100644 --- a/ci/README.md +++ b/ci/README.md @@ -43,7 +43,7 @@ These issues effectively list PRs the merge bot has interacted with. To ensure security and a focused utility, the bot adheres to specific limitations: - The PR targets one of the [development branches](#branch-classification). -- The PR only touches packages located under `pkgs/by-name/*`. +- The PR only touches files of packages located under `pkgs/by-name/*`. - The PR is either: - approved by a [committer][@NixOS/nixpkgs-committers]. - authored by a [committer][@NixOS/nixpkgs-committers]. diff --git a/ci/github-script/merge.js b/ci/github-script/merge.js index c738ecc950f5..779b5dffcab0 100644 --- a/ci/github-script/merge.js +++ b/ci/github-script/merge.js @@ -10,13 +10,15 @@ function runChecklist({ user, userIsMaintainer, }) { - const allByName = files.every(({ filename }) => - filename.startsWith('pkgs/by-name/'), + const allByName = files.every( + ({ filename }) => + filename.startsWith('pkgs/by-name/') && filename.split('/').length > 4, ) const packages = files .filter(({ filename }) => filename.startsWith('pkgs/by-name/')) .map(({ filename }) => filename.split('/')[3]) + .filter(Boolean) const eligible = !packages.length ? new Set() @@ -40,7 +42,7 @@ function runChecklist({ const checklist = { 'PR targets a [development branch](https://github.com/NixOS/nixpkgs/blob/-/ci/README.md#branch-classification).': classify(pull_request.base.ref).type.includes('development'), - 'PR touches only packages in `pkgs/by-name/`.': allByName, + 'PR touches only files of packages in `pkgs/by-name/`.': allByName, 'PR is at least one of:': { 'Approved by a committer.': committers.intersection(approvals).size > 0, 'Authored by a committer.': committers.has(pull_request.user.id),