Skip to content

[code-infra] Improve display of bundle size diff #95

[code-infra] Improve display of bundle size diff

[code-infra] Improve display of bundle size diff #95

name: Add reviewers to PRs
on:
pull_request_target:
branches: ['master', 'next']
types: ['labeled']
workflow_call:
inputs:
team-slug:
description: 'The slug of the team from which reviewers get collected'
required: true
type: string
label-name:
description: 'The name of the label that triggers the action'
required: true
type: string
secrets:
token:
description: 'The github token to use for the API calls. You can use the GITHUB_TOKEN secret'
required: true
permissions: {}
jobs:
add-reviewers-to-pr:
# Tests that label is added on the PR
if: ${{ github.event.label.name == inputs.label-name }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- id: get-members
env:
GH_TOKEN: ${{ secrets.token }}
run: |
DATA=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/${{ github.repository_owner }}/teams/${{ inputs.team-slug }}/members \
| jq 'reduce inputs as $i (.; . += $i)') \
echo "data=$DATA" >> $GITHUB_OUTPUT
# assign reviewers
- id: assign-reviewers
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{"reviewers":[${{ join(fromJson(steps.get-members.outputs.data).*.login) }}]}' \