From 91c4d9236b2b95cda0b806a8185d6775626b0711 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 12 Oct 2025 14:27:24 +0200 Subject: [PATCH] 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. --- .github/workflows/backport.yml | 5 +++-- ci/README.md | 5 +++-- ci/github-script/merge.js | 12 +++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 1826675c7501..b08714a31f12 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -57,8 +57,9 @@ jobs: pull_description: |- 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). - * Even as a non-committer, if you find that it is not acceptable, leave a comment. + **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. - name: Log current API rate limits env: diff --git a/ci/README.md b/ci/README.md index 500abbfb637f..558a31735165 100644 --- a/ci/README.md +++ b/ci/README.md @@ -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: -- 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 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/). - 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. diff --git a/ci/github-script/merge.js b/ci/github-script/merge.js index 5128124ac2eb..eb122a5a188d 100644 --- a/ci/github-script/merge.js +++ b/ci/github-script/merge.js @@ -1,3 +1,5 @@ +const { classify } = require('../supportedBranches.js') + function runChecklist({ committers, files, @@ -22,14 +24,14 @@ function runChecklist({ .reduce((acc, cur) => acc?.intersection(cur) ?? cur) const checklist = { - 'PR targets one of the allowed branches: master, staging, staging-next.': [ - 'master', - 'staging', - 'staging-next', - ].includes(pull_request.base.ref), + '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 is at least one of:': { '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', }, }