Skip to content

Commit

Permalink
Fixup requested_reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed May 27, 2023
1 parent be89b7d commit 2708abf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/automerge-prs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ if is_dependabot && ! exclude_by_title "$GH_PR_TITLE"; then
case "$GH_PR_ACTION" in
opened)
if [[ "$REMOVE_REVIEWERS" == 'true' ]]; then
echo "Removing review requests"
gh api -X DELETE "repos/$GH_REPO/pulls/$GH_PR_NUMBER/requested_reviewers"
read -r users_json < <(gh api "repos/$GH_REPO/pulls/$GH_PR_NUMBER/requested_reviewers" | jq '[.users[].login]' -c)
read -r teams_json < <(gh api "repos/$GH_REPO/pulls/$GH_PR_NUMBER/requested_reviewers" | jq '[.teams[].name]' -c)

if [[ "$users_json" != '[]' ]] || [[ "$teams_json" != '[]' ]]; then
echo "Removing requested reviewers"
echo "{\"reviewers\":$users_json,\"team_reviewers\":$teams_json}" |
gh api -X DELETE --input - "repos/$GH_REPO/pulls/$GH_PR_NUMBER/requested_reviewers"
fi
fi

cat >"$tmp/message" <<EOM
Expand Down

0 comments on commit 2708abf

Please sign in to comment.