-
Notifications
You must be signed in to change notification settings - Fork 1.8k
95 lines (81 loc) · 2.86 KB
/
approve-checker.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
83
84
85
86
87
88
89
90
91
92
93
94
95
name: REVIEW CHECKER
on:
pull_request_review:
types:
- submitted
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:
info:
if: >
(github.event.pull_request && github.event.requested_team) ||
(github.event.pull_request.requested_teams && github.event.review && github.event.review.state == 'approved')
runs-on: ubuntu-latest
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
LABELS: ${{ steps.label_info.outputs.labels }}
PR_NUMBER: ${{ steps.pr.outputs.PR_NUMBER }}
HEAD_REF: ${{ steps.pr.outputs.HEAD_REF }}
steps:
- name: PR
id: pr
run: |
if [[ "${{ github.event.number }}" != "" ]]; then
echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_OUTPUT
else
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "HEAD_REF=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
fi
- name: LABELS
id: label_info
env:
PR_NUMBER: ${{ steps.pr.outputs.PR_NUMBER }}
run: |
labels=$(gh pr view ${PR_NUMBER} -R ${REPO} --json labels -q '.labels[].name')
echo "labels<<EOF" >> $GITHUB_OUTPUT
echo "$labels" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
meta-review:
needs: info
runs-on: [ self-hosted, normal ]
if: github.event_name == 'pull_request_review' && contains(needs.info.outputs.LABELS, 'META-REVIEW') && !contains(needs.info.outputs.LABELS, 'sync') && !startsWith(needs.info.outputs.HEAD_REF, 'mergify/')
name: META-REVIEW
env:
PR_NUMBER: ${{ needs.info.outputs.PR_NUMBER }}
REPO: ${{ github.repository }}
TEAM: meta-committer
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: META-REVIEW
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-approve.sh
proto-review:
needs: info
runs-on: [ self-hosted, normal ]
if: github.event_name == 'pull_request_review' && contains(needs.info.outputs.LABELS, 'PROTO-REVIEW') && !contains(needs.info.outputs.LABELS, 'sync') && !startsWith(needs.info.outputs.HEAD_REF, 'mergify/')
name: PROTO-REVIEW
env:
PR_NUMBER: ${{ needs.info.outputs.PR_NUMBER }}
REPO: ${{ github.repository }}
TEAM: proto-team
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: PROTO-REVIEW
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-approve.sh