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
2 changed files with 6 additions and 4 deletions

View File

@@ -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),