22
22
statuses : write
23
23
checks : write
24
24
pull-requests : write
25
+ contents : write
25
26
steps :
27
+ - uses : actions/checkout@v4
28
+ with :
29
+ ref : gh-pages
30
+
26
31
- name : Download and Extract Artifacts
27
32
uses : dawidd6/action-download-artifact@v6
28
33
with :
@@ -35,15 +40,18 @@ jobs:
35
40
original_action=$(cat ./artifacts/parent-artifacts/action.txt)
36
41
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
37
42
original_ref=$(cat ./artifacts/parent-artifacts/ref.txt)
43
+ original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt)
38
44
echo "original_event=$original_event" >> $GITHUB_ENV
39
45
echo "original_action=$original_action" >> $GITHUB_ENV
40
46
echo "original_sha=$original_sha" >> $GITHUB_ENV
41
47
echo "original_ref=$original_ref" >> $GITHUB_ENV
48
+ echo "original_conclusion=$original_conclusion" >> $GITHUB_ENV
42
49
43
50
echo "original_event = $original_event"
44
51
echo "original_action = $original_action"
45
52
echo "original_sha = $original_sha"
46
53
echo "original_ref = $original_ref"
54
+ echo "original_conclusion = $original_conclusion"
47
55
48
56
- name : Publish Unit Test Results
49
57
uses : EnricoMi/publish-unit-test-result-action@v2
54
62
files : ./artifacts/**/*.xml
55
63
action_fail : true
56
64
65
+ - name : Fail if tests failed
66
+ if : ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}
67
+ run : exit 1
68
+
57
69
- name : Clean up caches
58
70
if : always()
59
71
uses : actions/github-script@v7
@@ -102,7 +114,33 @@ jobs:
102
114
repo: repo,
103
115
sha: sha,
104
116
state: '${{ job.status }}',
105
- description: '${{ job.status }}' ? 'Runtime tests successful' : 'Runtime tests failed',
117
+ description: '${{ job.status }}' == 'success' ? 'Runtime tests successful' : 'Runtime tests failed',
106
118
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
107
119
})).data;
108
120
core.info(`${name} is ${state}`);
121
+
122
+ - name : Create output folder
123
+ if : ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
124
+ run : |
125
+ rm -rf artifacts
126
+ mkdir -p runtime-tests-results
127
+
128
+ - name : Generate badge
129
+ if : ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
130
+ uses :
jaywcjlove/[email protected]
131
+ with :
132
+ label : Runtime Tests
133
+ status : ${{ job.status }}
134
+ output : runtime-tests-results/badge.svg
135
+ color : ${{ job.status == 'success' && 'green' || 'red' }}
136
+
137
+ - name : Push badge
138
+ if : ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
139
+ run : |
140
+ git config user.name "github-actions[bot]"
141
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
142
+ if [[ `git status --porcelain` ]]; then
143
+ git add --all
144
+ git commit -m "Updated runtime tests badge"
145
+ git push origin HEAD:gh-pages
146
+ fi
0 commit comments