-
Notifications
You must be signed in to change notification settings - Fork 8
43 lines (41 loc) · 1.5 KB
/
size-label.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: size-label
on: pull_request_target
jobs:
size-label:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: size-label
uses: "webdoky/size-label-action@main"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# assign-reviewers:
# needs: [size-label]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Assign/Remove reviewers based on size label
# run: |
# PR_NUMBER=${{ github.event.pull_request.number }}
# LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')
# REVIEWER="${{ github.repository_owner }}/translators"
# if [[ $LABELS == *"size/XS"* ]] || [[ $LABELS != *"size/"* ]]; then
# gh api \
# --method DELETE \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers \
# -f "team_reviewers[]=$REVIEWER"
# else
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers \
# -f "team_reviewers[]=$REVIEWER"
# fi
# env:
# GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"