Unverified Commit 94fc102d authored by Wolfgang Walther's avatar Wolfgang Walther Committed by GitHub
Browse files

ci/github-script/merge: two minor improvements (#458020)

parents 9d71961d 5407abeb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -43,12 +43,12 @@ 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 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:
  - approved by a [committer][@NixOS/nixpkgs-committers].
  - authored by a [committer][@NixOS/nixpkgs-committers].
  - backported via label.
  - created by [@r-ryantm](https://nix-community.github.io/nixpkgs-update/r-ryantm/).
  - opened by a [committer][@NixOS/nixpkgs-committers].
  - opened 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
@@ -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,14 +42,14 @@ 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),
      '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',
      'Opened by a committer.': committers.has(pull_request.user.id),
      'Opened by r-ryantm.': pull_request.user.login === 'r-ryantm',
    },
  }