77 SWAGLABS_USERNAME : ${{ secrets.SWAGLABS_USERNAME }}
88 SWAGLABS_PASSWORD : ${{ secrets.SWAGLABS_PASSWORD }}
99 DISCORD_WEBHOOK_URL : ${{ secrets.DISCORD_WEBHOOK_URL }}
10+ DISCORD_SCRIPT : |
11+ passed="${{ steps.summary.outputs.passed }}"
12+ failed="${{ steps.summary.outputs.failed }}"
13+ skipped="${{ steps.summary.outputs.skipped }}"
14+ total="${{ steps.summary.outputs.total }}"
15+ pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
16+ fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
17+
18+ content="-----------------------------------\n\n"
19+ content+="🛠️ **Job: ${{ github.job }}**\n"
20+ content+="👤 **User: ${{ github.actor }}**\n"
21+ content+="🌎 **Browser: ${{ matrix.browser }}**\n"
22+ content+="🎉 **Passed**: ${passed}\n"
23+ content+="❌ **Failed**: ${failed}\n"
24+ content+="⚠️ **Skipped**: ${skipped}\n"
25+ content+="📊 **Total**: ${total}\n\n"
26+ content+="✅ **Pass %**: ${pass_percentage}%\n"
27+ content+="❌ **Fail %**: ${fail_percentage}%\n\n"
28+ content+="-----------------------------------\n\n"
29+
30+ curl --location "$DISCORD_WEBHOOK_URL" \
31+ --header 'Content-Type: application/json' \
32+ --data-raw "{
33+ \"content\": \"$content\",
34+ \"username\": \"TestBot\"
35+ }"
1036
1137on :
1238 workflow_dispatch :
@@ -142,32 +168,8 @@ jobs:
142168 if : always()
143169
144170 - name : Send Results to Discord
145- run : |
146- passed="${{ steps.summary.outputs.passed }}"
147- failed="${{ steps.summary.outputs.failed }}"
148- skipped="${{ steps.summary.outputs.skipped }}"
149- total="${{ steps.summary.outputs.total }}"
150- pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
151- fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
152-
153- content="-----------------------------------\n\n"
154- content+="🛠️ **Job: ${{ github.job }}**\n"
155- content+="👤 **User: ${{ github.actor }}**\n"
156- content+="🌎 **Browser: ${{ matrix.browser }}**\n"
157- content+="🎉 **Passed**: ${passed}\n"
158- content+="❌ **Failed**: ${failed}\n"
159- content+="⚠️ **Skipped**: ${skipped}\n"
160- content+="📊 **Total**: ${total}\n\n"
161- content+="✅ **Pass %**: ${pass_percentage}%\n"
162- content+="❌ **Fail %**: ${fail_percentage}%\n\n"
163- content+="-----------------------------------\n\n"
164-
165- curl --location "$DISCORD_WEBHOOK_URL" \
166- --header 'Content-Type: application/json' \
167- --data-raw "{
168- \"content\": \"$content\",
169- \"username\": \"TestBot\"
170- }"
171+ run : $DISCORD_SCRIPT
172+
171173 regression_tests :
172174 name : Run Regression Tests
173175 runs-on : ubuntu-latest
@@ -213,32 +215,7 @@ jobs:
213215 if : always()
214216
215217 - name : Send Results to Discord
216- run : |
217- passed="${{ steps.summary.outputs.passed }}"
218- failed="${{ steps.summary.outputs.failed }}"
219- skipped="${{ steps.summary.outputs.skipped }}"
220- total="${{ steps.summary.outputs.total }}"
221- pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
222- fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
223-
224- content="-----------------------------------\n\n"
225- content+="🛠️ **Job: ${{ github.job }}**\n"
226- content+="👤 **User: ${{ github.actor }}**\n"
227- content+="🌎 **Browser: ${{ matrix.browser }}**\n"
228- content+="🎉 **Passed**: ${passed}\n"
229- content+="❌ **Failed**: ${failed}\n"
230- content+="⚠️ **Skipped**: ${skipped}\n"
231- content+="📊 **Total**: ${total}\n\n"
232- content+="✅ **Pass %**: ${pass_percentage}%\n"
233- content+="❌ **Fail %**: ${fail_percentage}%\n\n"
234- content+="-----------------------------------\n\n"
235-
236- curl --location "$DISCORD_WEBHOOK_URL" \
237- --header 'Content-Type: application/json' \
238- --data-raw "{
239- \"content\": \"$content\",
240- \"username\": \"TestBot\"
241- }"
218+ run : $DISCORD_SCRIPT
242219
243220 e2e_tests :
244221 name : Run E2E Tests
@@ -289,29 +266,4 @@ jobs:
289266 if : always()
290267
291268 - name : Send Results to Discord
292- run : |
293- passed="${{ steps.summary.outputs.passed }}"
294- failed="${{ steps.summary.outputs.failed }}"
295- skipped="${{ steps.summary.outputs.skipped }}"
296- total="${{ steps.summary.outputs.total }}"
297- pass_percentage=$(awk "BEGIN {print ($passed/$total)*100}")
298- fail_percentage=$(awk "BEGIN {print ($failed/$total)*100}")
299-
300- content="-----------------------------------\n\n"
301- content+="🛠️ **Job: ${{ github.job }}**\n"
302- content+="👤 **User: ${{ github.actor }}**\n"
303- content+="🌎 **Browser: ${{ matrix.browser }}**\n"
304- content+="🎉 **Passed**: ${passed}\n"
305- content+="❌ **Failed**: ${failed}\n"
306- content+="⚠️ **Skipped**: ${skipped}\n"
307- content+="📊 **Total**: ${total}\n\n"
308- content+="✅ **Pass %**: ${pass_percentage}%\n"
309- content+="❌ **Fail %**: ${fail_percentage}%\n\n"
310- content+="-----------------------------------\n\n"
311-
312- curl --location "$DISCORD_WEBHOOK_URL" \
313- --header 'Content-Type: application/json' \
314- --data-raw "{
315- \"content\": \"$content\",
316- \"username\": \"TestBot\"
317- }"
269+ run : $DISCORD_SCRIPT
0 commit comments