-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (42 loc) · 1.56 KB
/
final.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
name: Final Check
on:
workflow_dispatch:
repository_dispatch:
types: [ final_check ]
permissions:
contents: read
jobs:
final-check:
runs-on: ubuntu-latest
steps:
- name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
echo "deb [arch=amd64] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Checkout repository
uses: actions/checkout@v3
- name: Get PR number
id: get_pr_number
run: echo "PR_NUMBER=${{ github.event.client_payload.pull_request_number }}" >> $GITHUB_ENV
- name: Check Dummy and CI statuses
id: check-status
run: |
PR_NUMBER=${{ env.PR_NUMBER }}
DUMMY_STATUS=$(gh pr checks $PR_NUMBER | grep 'Dummy / build' | awk '{print $2}')
CI_STATUS=$(gh pr checks $PR_NUMBER | grep 'CI / build' | awk '{print $2}')
if [[ "$DUMMY_STATUS" == "success" ]] || [[ "$CI_STATUS" == "success" ]]; then
echo "One or both checks have passed."
echo "status=success" >> $GITHUB_ENV
else
echo "Both checks failed."
echo "status=failure" >> $GITHUB_ENV
fi
- name: Set final status success
if: env.status == 'success'
run: echo "Final status is success"
continue-on-error: true
- name: Set final status failure
if: env.status == 'failure'
run: exit 1