Skip to content

Commit 077007a

Browse files
committed
ci/request-reviews: Don't request reviews from non-repo-collaborators
Fixes this problem for maintainer-based reviews when the maintainer didn't yet accept or missed the automated invite: gh: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the NixOS/nixpkgs repository. (HTTP 422)
1 parent ab248be commit 077007a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ci/request-reviews/process-reviewers.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ while read -r user; do
4747
fi
4848
done < "$tmp/already-reviewed-by"
4949

50+
for user in "${!users[@]}"; do
51+
if ! gh api \
52+
-H "Accept: application/vnd.github+json" \
53+
-H "X-GitHub-Api-Version: 2022-11-28" \
54+
"/repos/$baseRepo/collaborators/$user" >&2; then
55+
log "User $user is not a repository collaborator, probably missed the automated invite to the maintainers team (see <https://github.com/NixOS/nixpkgs/issues/234293>), ignoring"
56+
unset 'users[$user]'
57+
fi
58+
done
59+
5060
# Turn it into a JSON for the GitHub API call to request PR reviewers
5161
jq -n \
5262
--arg users "${!users[*]}" \

0 commit comments

Comments
 (0)