Skip to content

chore(test): remove legacy API test suite and related infrastructure #196

chore(test): remove legacy API test suite and related infrastructure

chore(test): remove legacy API test suite and related infrastructure #196

name: Assign Reviewers
on:
pull_request_target:
types: [opened, ready_for_review]
permissions:
pull-requests: write
jobs:
assign:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Assign default reviewers if none set
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REVIEWERS_JSON: ${{ toJson(github.event.pull_request.requested_reviewers) }}
TEAMS_JSON: ${{ toJson(github.event.pull_request.requested_teams) }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
reviewers=$(echo "$REVIEWERS_JSON" | jq 'length')
teams=$(echo "$TEAMS_JSON" | jq 'length')
if [ "$reviewers" -eq 0 ] && [ "$teams" -eq 0 ]; then
echo '["cb1kenobi","heskew","Ethan-Arrowood","kriszyp"]' \
| jq --arg author "$PR_AUTHOR" '{"reviewers": [.[] | select(. != $author)]}' \
| gh api "repos/$REPO/pulls/$PR_NUMBER/requested_reviewers" \
--method POST \
--input -
fi