-
Notifications
You must be signed in to change notification settings - Fork 39
51 lines (42 loc) · 1.43 KB
/
require-garnix-success.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
name: Require Garnix CI Success
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
merge_group:
permissions:
checks: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
evaluate-app-status:
runs-on: ubuntu-latest
steps:
- name: Evaluate Checks
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
REF: ${{ github.head_ref }}
run: |
sleep 15
status=''
while [[ $status != 'completed' ]]; do
check_suites=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPO/commits/$REF/check-suites")
status=$(echo "$check_suites" | jq -r '.check_suites | .[] | select(.app.name == "Garnix CI") | .status')
sleep 15
done
conclusion=$(echo "$check_suites" | jq -r '.check_suites | .[] | select(.app.name == "Garnix CI") | .conclusion')
case "$conclusion" in
failure | timed_out | action_required | stale | startup_failure)
echo "ERROR: Garnix CI concluded with $conclusion"
exit 1
;;
*)
echo "INFO: Garnix CI concluded with $conclusion"
;;
esac