Unverified Commit 37b77739 authored by Wolfgang Walther's avatar Wolfgang Walther Committed by GitHub
Browse files

workflows/bot: allow maintainers to merge backports (#451324)

parents 95f18db6 91c4d923
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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:
+3 −2
Original line number Diff line number Diff line
@@ -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.
+7 −5
Original line number Diff line number Diff line
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',
    },
  }