From b844cba4e6fcac4c4ceef81e481a5f93a01e4631 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 18 Dec 2024 22:05:49 +0100 Subject: [PATCH] workflows/eval: Use maintainer GitHub IDs for review requests of changed packages The handles can change over time and there's nothing guaranteeing the ones in the maintainer list are up-to-date. In comparison GitHub IDs never change. --- .github/workflows/eval.yml | 9 ++++++++- ci/eval/compare/maintainers.nix | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index a0604bbc8fcd4..487c70f267c9d 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -267,11 +267,18 @@ jobs: -f "labels[]=$toAdd" done < <(comm -13 before after) + # maintainers.json contains GitHub IDs. Look up handles to request reviews from. + # There appears to be no API to request reviews based on GitHub IDs + jq -r 'keys[]' comparison/maintainers.json \ + | while read -r id; do gh api /user/"$id"; done \ + | jq -s '{ reviewers: map(.login) }' \ + > reviewers.json + # Request reviewers from maintainers of changed output paths GH_TOKEN=${{ steps.app-token.outputs.token }} gh api \ --method POST \ /repos/${{ github.repository }}/pulls/${{ github.event.number }}/requested_reviewers \ - --input <(jq '{ reviewers: keys }' comparison/maintainers.json) + --input reviewers.json env: GH_TOKEN: ${{ github.token }} diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 0c08f85cec43b..6728929952d40 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -92,7 +92,7 @@ let builtins.map ( pkg: builtins.map (maintainer: { - handle = lib.toLower maintainer.github; + id = maintainer.githubId; packageName = pkg.name; dueToFiles = pkg.filenames; }) pkg.maintainers @@ -103,9 +103,9 @@ let ping: collector: collector // { - "${ping.handle}" = [ + "${toString ping.id}" = [ { inherit (ping) packageName dueToFiles; } - ] ++ (collector."${ping.handle}" or [ ]); + ] ++ (collector."${toString ping.id}" or [ ]); } ) { } listToPing;