-
Notifications
You must be signed in to change notification settings - Fork 1.8k
82 lines (74 loc) · 2.45 KB
/
label-action.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: LABEL ACTION
on:
pull_request_target:
types:
- labeled
- unlabeled
permissions:
checks: write
actions: write
contents: write
deployments: write
discussions: write
issues: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
jobs:
meta-review:
name: META REVIEW LABEL
if: github.event.label.name == 'META-REVIEW'
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
META_TEAM: meta-committer
GH_TOKEN: ${{ secrets.PAT }}
steps:
- name: ADD REVIEWER
if: github.event.action == 'labeled'
run: |
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 "reviewers[]=" -f "team_reviewers[]=${META_TEAM}" 1>/dev/null
- name: REMOVE REVIEWER
if: github.event.action == 'unlabeled'
run: |
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 "reviewers[]=" -f "team_reviewers[]=${META_TEAM}" 1>/dev/null
proto-review:
name: PROTO REVIEW LABEL
if: github.event.label.name == 'PROTO-REVIEW'
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PROTO_TEAM: proto-team
GH_TOKEN: ${{ secrets.PAT }}
steps:
- name: ADD REVIEWER
if: github.event.action == 'labeled'
run: |
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 "reviewers[]=" -f "team_reviewers[]=${PROTO_TEAM}" 1>/dev/null
- name: REMOVE REVIEWER
if: github.event.action == 'unlabeled'
run: |
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 "reviewers[]=" -f "team_reviewers[]=${PROTO_TEAM}" 1>/dev/null