Skip to content

Commit

Permalink
[infra] Fix automated reviewers assignment workflow - part 2 (mui#12989)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Engelen <[email protected]>
  • Loading branch information
michelengelen authored and thomasmoon committed Sep 6, 2024
1 parent 1229c2b commit 4729bbe
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/add-release-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
# Tests that label is added on the PR
if: ${{ github.event.label.name == 'release' }}
runs-on: ubuntu-latest
env:
ORG: ${{ github.event.organization }}
# we can use the team slug when making this a reusable workflow
TEAM_SLUG: x
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: read
pull-requests: write
Expand All @@ -21,27 +26,18 @@ jobs:
DATA=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/${{ORG}}/teams/${{TEAM_SLUG}}/members \
/orgs/$ORG/teams/$TEAM_SLUG/members?role=maintainer&per_page=100 \
| jq 'reduce inputs as $i (.; . += $i)') \
| echo "data=$DATA" >> $GITHUB_OUTPUT \
| echo "members=${{ join(fromJson(DATA).*.login) }}" >> $GITHUB_OUTPUT \
env:
ORG: ${{ github.event.organization }}
TEAM_SLUG: x
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo "data=$DATA" >> $GITHUB_OUTPUT
echo "members=${{ join(fromJson($DATA).*.login) }}" >> $GITHUB_OUTPUT
# assign reviewers
- id: assign-reviewers
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{GITHUB_TOKEN}}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ORG}}/${{REPO}}/pulls/${{PR_NUMBER}}/requested_reviewers \
-d '{"reviewers":[${{ steps.get-members.outputs.members }}]}' \
env:
ORG: ${{ github.event.organization }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$ORG/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{"reviewers":[${{ steps.get-members.outputs.members }}]}' \

0 comments on commit 4729bbe

Please sign in to comment.