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.
This commit is contained in:
Wolfgang Walther 2025-11-03 08:57:02 +01:00
parent 42d395e048
commit e0c0b2c54c
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1
2 changed files with 6 additions and 4 deletions

View file

@ -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: 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 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: - The PR is either:
- approved by a [committer][@NixOS/nixpkgs-committers]. - approved by a [committer][@NixOS/nixpkgs-committers].
- authored by a [committer][@NixOS/nixpkgs-committers]. - authored by a [committer][@NixOS/nixpkgs-committers].

View file

@ -10,13 +10,15 @@ function runChecklist({
user, user,
userIsMaintainer, userIsMaintainer,
}) { }) {
const allByName = files.every(({ filename }) => const allByName = files.every(
filename.startsWith('pkgs/by-name/'), ({ filename }) =>
filename.startsWith('pkgs/by-name/') && filename.split('/').length > 4,
) )
const packages = files const packages = files
.filter(({ filename }) => filename.startsWith('pkgs/by-name/')) .filter(({ filename }) => filename.startsWith('pkgs/by-name/'))
.map(({ filename }) => filename.split('/')[3]) .map(({ filename }) => filename.split('/')[3])
.filter(Boolean)
const eligible = !packages.length const eligible = !packages.length
? new Set() ? new Set()
@ -40,7 +42,7 @@ function runChecklist({
const checklist = { const checklist = {
'PR targets a [development branch](https://github.com/NixOS/nixpkgs/blob/-/ci/README.md#branch-classification).': 'PR targets a [development branch](https://github.com/NixOS/nixpkgs/blob/-/ci/README.md#branch-classification).':
classify(pull_request.base.ref).type.includes('development'), 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:': { 'PR is at least one of:': {
'Approved by a committer.': committers.intersection(approvals).size > 0, 'Approved by a committer.': committers.intersection(approvals).size > 0,
'Authored by a committer.': committers.has(pull_request.user.id), 'Authored by a committer.': committers.has(pull_request.user.id),