-
Notifications
You must be signed in to change notification settings - Fork 1.6k
52 lines (48 loc) · 1.74 KB
/
ci-checks.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
# This workflow checks if all CI checks have passed by polling every 5 minutes for a total of 8 attempts.
name: CI Check
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
check_ci_status:
runs-on: ubuntu-latest
permissions:
checks: read
pull-requests: write
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Check for 'needs-ok-to-test' and 'ok-to-test' labels
id: label_check
run: |
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if echo "$LABELS" | grep -q 'needs-ok-to-test'; then
echo "Label 'needs-ok-to-test' found. Skipping the workflow."
exit 0
fi
if echo "$LABELS" | grep -q 'ok-to-test'; then
echo "Label 'ok-to-test' found. Continuing the workflow."
else
echo "Label 'ok-to-test' not found. Skipping the workflow."
exit 0
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if all CI checks passed
uses: wechuli/allcheckspassed@0b68b3b7d92e595bcbdea0c860d05605720cf479
with:
delay: '5'
retries: '8'
polling_interval: '5'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save PR payload
shell: bash
run: |
mkdir -p ./pr
echo ${{ github.event.pull_request.number }} >> ./pr/pr_number
echo ${{ github.event.action }} >> ./pr/event_action
- uses: actions/[email protected]
with:
name: pr
path: pr/