From b2d1946eb28740b5817cc49ff8abd0b8b69bc28f Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 1 Nov 2025 10:52:38 +0100 Subject: [PATCH] workflows/reviewers: request owners and maintainers at once Instead of requesting owners and maintainer separately, each with their own limit of 10 review requests, we now run this together. This unties the logic and allows easier refactoring. Also, it gives us a consistent threshold of when not to request reviews anymore, which I set to 15. Before, this could have been anything between 10 and 20, depending on how the reviewers distributed over owners and maintainers. --- .github/workflows/reviewers.yml | 10 +++++----- ci/request-reviews/request-code-owner-reviews.sh | 5 +---- ci/request-reviews/request-reviewers.sh | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/reviewers.yml b/.github/workflows/reviewers.yml index f22e44d7cbff..4b49972e0732 100644 --- a/.github/workflows/reviewers.yml +++ b/.github/workflows/reviewers.yml @@ -69,15 +69,14 @@ jobs: GH_TOKEN: ${{ steps.app-token.outputs.token }} run: gh api /rate_limit | jq - - name: Requesting code owner reviews + - name: Determining code owner reviews if: steps.app-token.outputs.token env: GH_TOKEN: ${{ steps.app-token.outputs.token }} REPOSITORY: ${{ github.repository }} NUMBER: ${{ github.event.number }} - # Don't do anything on draft PRs - DRY_MODE: ${{ github.event.pull_request.draft && '1' || '' }} - run: result/bin/request-code-owner-reviews.sh "$REPOSITORY" "$NUMBER" ci/OWNERS + run: | + result/bin/request-code-owner-reviews.sh "$REPOSITORY" "$NUMBER" ci/OWNERS > owners.txt - name: Log current API rate limits (app-token) if: ${{ steps.app-token.outputs.token }} @@ -149,7 +148,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: gh api /rate_limit | jq - - name: Requesting maintainer reviews + - name: Requesting reviews if: ${{ steps.app-token.outputs.token }} env: GH_TOKEN: ${{ github.token }} @@ -164,6 +163,7 @@ jobs: # 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" --jq .login; done \ + | cat owners.txt - \ | GH_TOKEN="$APP_GH_TOKEN" result/bin/request-reviewers.sh "$REPOSITORY" "$NUMBER" "$AUTHOR" - name: Log current API rate limits (app-token) diff --git a/ci/request-reviews/request-code-owner-reviews.sh b/ci/request-reviews/request-code-owner-reviews.sh index 663285ae03fe..0ec61ab9f04e 100755 --- a/ci/request-reviews/request-code-owner-reviews.sh +++ b/ci/request-reviews/request-code-owner-reviews.sh @@ -31,8 +31,6 @@ prRepo=$(jq -r .head.repo.full_name <<< "$prInfo") log "PR repo: $prRepo" prBranch=$(jq -r .head.ref <<< "$prInfo") log "PR branch: $prBranch" -prAuthor=$(jq -r .user.login <<< "$prInfo") -log "PR author: $prAuthor" extraArgs=() if pwdRepo=$(git rev-parse --show-toplevel 2>/dev/null); then @@ -56,5 +54,4 @@ git -C "$tmp/nixpkgs.git" fetch --no-tags fork "$prBranch" headRef=$(git -C "$tmp/nixpkgs.git" rev-parse refs/remotes/fork/"$prBranch") log "Requesting reviews from code owners" -"$SCRIPT_DIR"/get-code-owners.sh "$tmp/nixpkgs.git" "$ownersFile" "$baseBranch" "$headRef" | \ - "$SCRIPT_DIR"/request-reviewers.sh "$baseRepo" "$prNumber" "$prAuthor" +"$SCRIPT_DIR"/get-code-owners.sh "$tmp/nixpkgs.git" "$ownersFile" "$baseBranch" "$headRef" diff --git a/ci/request-reviews/request-reviewers.sh b/ci/request-reviews/request-reviewers.sh index 1c105e385d28..6782b621b70b 100755 --- a/ci/request-reviews/request-reviewers.sh +++ b/ci/request-reviews/request-reviewers.sh @@ -68,7 +68,7 @@ for user in "${!users[@]}"; do fi done -if [[ "${#users[@]}" -gt 10 ]]; then +if [[ "${#users[@]}" -gt 15 ]]; then log "Too many reviewers (${!users[*]}), skipping review requests" exit 0 fi