ci/eval/compare: manage the "by: package-maintainer" label (#407465)

This commit is contained in:
Wolfgang Walther 2025-05-17 20:48:58 +00:00 committed by GitHub
commit 62cac4f0c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

@ -154,9 +154,12 @@ jobs:
--arg beforeResultDir ./targetResult \ --arg beforeResultDir ./targetResult \
--arg afterResultDir "$(realpath prResult)" \ --arg afterResultDir "$(realpath prResult)" \
--arg touchedFilesJson ./touched-files.json \ --arg touchedFilesJson ./touched-files.json \
--arg githubAuthorId "$AUTHOR_ID" \
-o comparison -o comparison
cat comparison/step-summary.md >> "$GITHUB_STEP_SUMMARY" cat comparison/step-summary.md >> "$GITHUB_STEP_SUMMARY"
env:
AUTHOR_ID: ${{ github.event.pull_request.user.id }}
- name: Upload the combined results - name: Upload the combined results
if: steps.targetRunId.outputs.targetRunId if: steps.targetRunId.outputs.targetRunId
@ -211,10 +214,10 @@ jobs:
- name: Labelling pull request - name: Labelling pull request
if: ${{ github.event_name == 'pull_request_target' && github.repository_owner == 'NixOS' }} if: ${{ github.event_name == 'pull_request_target' && github.repository_owner == 'NixOS' }}
run: | run: |
# Get all currently set rebuild labels # Get all currently set labels that we manage
gh api \ gh api \
/repos/"$REPOSITORY"/issues/"$NUMBER"/labels \ /repos/"$REPOSITORY"/issues/"$NUMBER"/labels \
--jq '.[].name | select(startswith("10.rebuild"))' \ --jq '.[].name | select(startswith("10.rebuild") or . == "11.by: package-maintainer")' \
| sort > before | sort > before
# And the labels that should be there # And the labels that should be there

View file

@ -10,6 +10,7 @@
beforeResultDir, beforeResultDir,
afterResultDir, afterResultDir,
touchedFilesJson, touchedFilesJson,
githubAuthorId,
byName ? false, byName ? false,
}: }:
let let
@ -114,7 +115,15 @@ let
# Adds "10.rebuild-*-stdenv" label if the "stdenv" attribute was changed # Adds "10.rebuild-*-stdenv" label if the "stdenv" attribute was changed
++ lib.mapAttrsToList (kernel: _: "10.rebuild-${kernel}-stdenv") ( ++ lib.mapAttrsToList (kernel: _: "10.rebuild-${kernel}-stdenv") (
lib.filterAttrs (_: kernelRebuilds: kernelRebuilds ? "stdenv") rebuildsByKernel lib.filterAttrs (_: kernelRebuilds: kernelRebuilds ? "stdenv") rebuildsByKernel
); )
# Adds the "11.by: package-maintainer" label if all of the packages directly
# changed are maintained by the PR's author. (https://github.com/NixOS/ofborg/blob/df400f44502d4a4a80fa283d33f2e55a4e43ee90/ofborg/src/tagger.rs#L83-L88)
++ lib.optional (
maintainers ? ${githubAuthorId}
&& lib.all (lib.flip lib.elem maintainers.${githubAuthorId}) (
lib.flatten (lib.attrValues maintainers)
)
) "11.by: package-maintainer";
} }
); );