workflows/bot: allow maintainers to merge backports

All other conditions equal, there is no reason to prevent maintainers
from backporting changes to their packages. Maintainers are probably in
the *best* position to tell whether a certain change is backportable or
not - because they know the package well.
This commit is contained in:
Wolfgang Walther
2025-10-12 14:27:24 +02:00
parent c46f68da78
commit 91c4d9236b
3 changed files with 13 additions and 9 deletions

View File

@@ -57,8 +57,9 @@ jobs:
pull_description: |- pull_description: |-
Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}. Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
* [ ] Before merging, ensure that this backport is [acceptable for the release](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#changes-acceptable-for-releases). **Before merging, ensure that this backport is [acceptable for the release](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#changes-acceptable-for-releases).**
* Even as a non-committer, if you find that it is not acceptable, leave a comment.
Even as a non-committer, if you find that it is not acceptable, leave a comment.
- name: Log current API rate limits - name: Log current API rate limits
env: env:

View File

@@ -42,10 +42,11 @@ 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 `master`, `staging`, or `staging-next`. - The PR targets one of the [development branches](#branch-classification).
- The PR only touches packages located under `pkgs/by-name/*`. - The PR only touches packages located under `pkgs/by-name/*`.
- The PR is either: - The PR is either:
- authored by a [committer][@NixOS/nixpkgs-committers], or - authored by a [committer][@NixOS/nixpkgs-committers],
- backported via label, or
- created by [@r-ryantm](https://nix-community.github.io/nixpkgs-update/r-ryantm/). - created by [@r-ryantm](https://nix-community.github.io/nixpkgs-update/r-ryantm/).
- The user attempting to merge is a member of [@NixOS/nixpkgs-maintainers]. - The user attempting to merge is a member of [@NixOS/nixpkgs-maintainers].
- The user attempting to merge is a maintainer of all packages touched by the PR. - The user attempting to merge is a maintainer of all packages touched by the PR.

View File

@@ -1,3 +1,5 @@
const { classify } = require('../supportedBranches.js')
function runChecklist({ function runChecklist({
committers, committers,
files, files,
@@ -22,14 +24,14 @@ function runChecklist({
.reduce((acc, cur) => acc?.intersection(cur) ?? cur) .reduce((acc, cur) => acc?.intersection(cur) ?? cur)
const checklist = { const checklist = {
'PR targets one of the allowed branches: master, staging, staging-next.': [ 'PR targets a [development branch](https://github.com/NixOS/nixpkgs/blob/-/ci/README.md#branch-classification).':
'master', classify(pull_request.base.ref).type.includes('development'),
'staging',
'staging-next',
].includes(pull_request.base.ref),
'PR touches only packages in `pkgs/by-name/`.': allByName, 'PR touches only packages in `pkgs/by-name/`.': allByName,
'PR is at least one of:': { 'PR is at least one of:': {
'Authored by a committer.': committers.has(pull_request.user.id), 'Authored by a committer.': committers.has(pull_request.user.id),
'Backported via label.':
pull_request.user.login === 'nixpkgs-ci[bot]' &&
pull_request.head.ref.startsWith('backport-'),
'Created by r-ryantm.': pull_request.user.login === 'r-ryantm', 'Created by r-ryantm.': pull_request.user.login === 'r-ryantm',
}, },
} }