-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (38 loc) · 1.25 KB
/
check-approvals.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
name: Check approvals
on:
pull_request:
types:
- labeled
- unlabeled
pull_request_review:
jobs:
check-approvals-tooling:
name: Tooling
if: contains(github.event.pull_request.labels.*.name, 'tooling')
runs-on: ubuntu-latest
steps:
- run: |
echo "Approvals required: ${APPROVALS_REQUIRED}"
gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
| jq '.[] | "\(.user.login) \(.state)"' \
| uniq \
| grep -c 'APPROVED' \
| xargs test "${APPROVALS_REQUIRED}" -le
env:
GH_TOKEN: ${{ github.token }}
APPROVALS_REQUIRED: 1
check-approvals-rfcs:
name: RFCs
if: "!contains(github.event.pull_request.labels.*.name, 'tooling')"
runs-on: ubuntu-latest
steps:
- run: |
echo "Approvals required: ${APPROVALS_REQUIRED}"
gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
| jq '.[] | "\(.user.login) \(.state)"' \
| uniq \
| grep -c 'APPROVED' \
| xargs test "${APPROVALS_REQUIRED}" -le
env:
GH_TOKEN: ${{ github.token }}
APPROVALS_REQUIRED: 3