ci/tag-maintainers: don't remove review requests
Some checks failed
Publish every Git push to main to FlakeHub / flakehub-publish (push) Has been cancelled
Publish every git push to Flakestry / publish-flake (push) Has been cancelled
Documentation / Version info (push) Has been cancelled
Documentation / Build (push) Has been cancelled
Documentation / Combine builds (push) Has been cancelled
Documentation / Deploy (push) Has been cancelled

We can't distinguish between manual review requests and requests created
by CI, so let's avoid removing any review requests.
This commit is contained in:
Matt Sturgeon 2025-07-10 13:45:29 +01:00
parent db7c5364a5
commit b728cf43d9

View file

@ -135,45 +135,6 @@ jobs:
echo "new_reviewers=${NEW_REVIEWERS_LIST% }" >> "$GITHUB_OUTPUT"
echo "New reviewers to add: ${NEW_REVIEWERS_LIST% }"
# Remove reviewers who are no longer maintainers of the changed files.
- name: Remove outdated reviewers
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
MAINTAINERS: ${{ steps.extract-maintainers.outputs.maintainers }}
PENDING_REVIEWERS: ${{ steps.current-reviewers.outputs.pending_reviewers }}
REPO: ${{ github.repository }}
PR_NUM: ${{ github.event.pull_request.number }}
run: |
remove_reviewers() {
local reviewers_to_remove="$1"
local reason="$2"
for REVIEWER in $reviewers_to_remove; do
echo "Removing review request from $REVIEWER ($reason)"
REVIEWER_JSON=$(jq -n -c --arg r "$REVIEWER" '{reviewers: [$r]}')
gh api --method DELETE "/repos/$REPO/pulls/$PR_NUM/requested_reviewers" \
--input - <<< "$REVIEWER_JSON" > /dev/null
done
}
# If no maintainers were found for the current set of files, remove all pending reviewers.
if [[ -z "$MAINTAINERS" ]]; then
if [[ -n "$PENDING_REVIEWERS" ]]; then
echo "No plugin maintainers found, removing all pending reviewers."
remove_reviewers "$PENDING_REVIEWERS" "no longer a maintainer of changed files"
fi
exit 0
fi
# Find reviewers who are in the pending list but NOT in the current maintainer list.
CURRENT_MAINTAINERS=$(echo "$MAINTAINERS" | tr ' ' '\n' | sort -u)
OUTDATED_REVIEWERS=$(comm -23 <(echo "$PENDING_REVIEWERS" | tr ' ' '\n' | sort -u) <(echo "$CURRENT_MAINTAINERS"))
if [[ -n "$OUTDATED_REVIEWERS" ]]; then
remove_reviewers "$OUTDATED_REVIEWERS" "no longer a maintainer of changed files"
else
echo "No outdated reviewers to remove."
fi
# Add the new, filtered list of maintainers as reviewers to the PR.
- name: Add new reviewers
env: