-
Notifications
You must be signed in to change notification settings - Fork 12
105 lines (103 loc) · 3.28 KB
/
statuscheck-runner.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
96
97
98
99
100
101
102
103
104
105
name: Status Check Runner
on:
issue_comment:
types:
- created
jobs:
checkif:
runs-on: ubuntu-latest
name: Check Comment Content
outputs:
shouldc: ${{ steps.checkc.outputs.shouldc }}
shouldtun: ${{ steps.checkc.outputs.shouldtun }}
shouldtui: ${{ steps.checkc.outputs.shouldtui }}
shouldta: ${{ steps.checkc.outputs.shouldta }}
steps:
- name: Check
id: checkc
run: |
if [[ "${{ github.event.comment.body }}" != *"!Run check"* ]]; then
echo "The comment content does not contain the specified text. Cancelling workflow."
echo "::set-output name=shouldc::false"
else
echo "The comment content contains the specified text. Continuing with further actions."
echo "::set-output name=shouldc::true"
fi
if [[ "${{ github.event.comment.body }}" != *"!Run unit test"* ]]; then
echo "::set-output name=shouldtun::false"
else
echo "::set-output name=shouldtun::true"
fi
if [[ "${{ github.event.comment.body }}" != *"!Run UI test"* ]]; then
echo "::set-output name=shouldtui::false"
else
echo "::set-output name=shouldtui::true"
fi
if [[ "${{ github.event.comment.body }}" != *"!Run test"* ]]; then
echo "::set-output name=shouldta::false"
else
echo "::set-output name=shouldta::true"
fi
get-head-sha:
name: Get Pull Request Head SHA
needs: checkif
runs-on: ubuntu-latest
outputs:
psha: ${{ steps.getsha.outputs.psha }}
env:
slink: ${{ github.event.issue.pull_request.url }}
steps:
- name: Get SHA
id: getsha
run: |
json_data=$(curl -s "$slink")
sha=$(echo "$json_data" | jq -r '.head.ref')
echo "psha=$sha" >> $GITHUB_OUTPUT
call-check-workflow:
name: Call Check Overflow
needs:
- get-head-sha
- checkif
if: ${{ needs.checkif.outputs.shouldc == 'true' }}
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: Call
uses: benc-uk/[email protected]
with:
workflow: status-check.yml
ref: ${{ needs.get-head-sha.outputs.psha }}
inputs: '{ "psha": "${{ needs.get-head-sha.outputs.psha }}"}'
call-unit-test-workflow:
name: Call Unit Test Overflow
needs:
- get-head-sha
- checkif
if: ${{ needs.checkif.outputs.shouldtun == 'true' }}
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: Call
uses: benc-uk/[email protected]
with:
workflow: unit-test.yml
ref: ${{ needs.get-head-sha.outputs.psha }}
inputs: '{ "psha": "${{ needs.get-head-sha.outputs.psha }}"}'
call-ui-test-workflow:
name: Call UI Test Overflow
needs:
- get-head-sha
- checkif
if: ${{ needs.checkif.outputs.shouldtui == 'true' }}
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: Call
uses: benc-uk/[email protected]
with:
workflow: ui-test.yml
ref: ${{ needs.get-head-sha.outputs.psha }}
inputs: '{ "psha": "${{ needs.get-head-sha.outputs.psha }}"}'