Skip to content

Commit d268bb1

Browse files
authored
Merge d4b70b4 into 914fb4d
2 parents 914fb4d + d4b70b4 commit d268bb1

File tree

1 file changed

+61
-19
lines changed

1 file changed

+61
-19
lines changed

.github/workflows/test.yml

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,26 @@ jobs:
178178
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179179
run: |
180180
CHECKS_TEMP_FILE="$(mktemp)"
181+
trap 'EXIT_CODE=$?; echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT; exit $EXIT_CODE' EXIT
182+
181183
sleep 10
182-
gh pr checks --watch >> $CHECKS_TEMP_FILE
183-
sleep 10
184-
gh pr checks --watch >> $CHECKS_TEMP_FILE
184+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
185+
while [ $PENDING -ne 0 ]
186+
do
187+
echo "::group::Pending checks: $PENDING"
188+
gh pr checks --watch
189+
sleep 10
190+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
191+
echo "::endgroup::"
192+
done
193+
gh pr checks >> $CHECKS_TEMP_FILE
185194
echo "::notice::Temp file content:
186195
187196
$(cat $CHECKS_TEMP_FILE)
188197
"
189-
echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT
190198
191199
- name: Report Checks
192-
if: ${{ steps.check-pr.outputs.checks-temp-file != '' }}
200+
if: ${{ always() && steps.check-pr.outputs.checks-temp-file != '' }}
193201
env:
194202
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195203
BASE_PR_NUMBER: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
@@ -200,7 +208,13 @@ jobs:
200208
201209
| Check | Status |
202210
| --- | --- |
203-
$(cat $CHECKS_TEMP_FILE | grep -E 'https://' | tac | awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' | sed -E 's/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
211+
$(cat $CHECKS_TEMP_FILE |
212+
grep -E 'https://' |
213+
tac |
214+
awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' |
215+
sed -E 's/(.*)\t(pass)\t(.*)\t(.*)\t(.*)/| [**\1**](\4) | \2 |/;
216+
s/(.*)\t(skipping)\t(.*)\t(.*)\t(.*)/| [~\1~](\4) | \2 |/;
217+
s/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
204218
rm -f $CHECKS_TEMP_FILE
205219
206220
- name: Close PR
@@ -305,7 +319,7 @@ jobs:
305319
BASE_PR_NUMBER: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
306320
run: |
307321
echo "::notice::Base PR number is $BASE_PR_NUMBER"
308-
gh pr create --base "$BASE_BRANCH_NAME" --title "Push Test PR for #$BASE_PR_NUMBER ($SHA)" --body "Generated from #$BASE_PR_NUMBER.
322+
gh pr create --base "$BASE_BRANCH_NAME" --title "Push as App Test PR for #$BASE_PR_NUMBER ($SHA)" --body "Generated from #$BASE_PR_NUMBER.
309323
310324
Run ID: [$RUN_ID]($(gh run view $RUN_ID --json 'url' --jq '.url')). Number: $RUN_NUMBER. Attempt: $RUN_ATTEMPT."
311325
TEST_PR_NUMBER=`gh pr view | grep 'number:' | cut -f 2`
@@ -318,18 +332,26 @@ jobs:
318332
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
319333
run: |
320334
CHECKS_TEMP_FILE="$(mktemp)"
335+
trap 'EXIT_CODE=$?; echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT; exit $EXIT_CODE' EXIT
336+
321337
sleep 10
322-
gh pr checks --watch >> $CHECKS_TEMP_FILE
323-
sleep 10
324-
gh pr checks --watch >> $CHECKS_TEMP_FILE
338+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
339+
while [ $PENDING -ne 0 ]
340+
do
341+
echo "::group::Pending checks: $PENDING"
342+
gh pr checks --watch
343+
sleep 10
344+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
345+
echo "::endgroup::"
346+
done
347+
gh pr checks >> $CHECKS_TEMP_FILE
325348
echo "::notice::Temp file content:
326349
327350
$(cat $CHECKS_TEMP_FILE)
328351
"
329-
echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT
330352
331353
- name: Report Checks
332-
if: ${{ steps.check-pr.outputs.checks-temp-file != '' }}
354+
if: ${{ always() && steps.check-pr.outputs.checks-temp-file != '' }}
333355
env:
334356
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
335357
BASE_PR_NUMBER: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
@@ -340,7 +362,13 @@ jobs:
340362
341363
| Check | Status |
342364
| --- | --- |
343-
$(cat $CHECKS_TEMP_FILE | grep -E 'https://' | tac | awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' | sed -E 's/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
365+
$(cat $CHECKS_TEMP_FILE |
366+
grep -E 'https://' |
367+
tac |
368+
awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' |
369+
sed -E 's/(.*)\t(pass)\t(.*)\t(.*)\t(.*)/| [**\1**](\4) | \2 |/;
370+
s/(.*)\t(skipping)\t(.*)\t(.*)\t(.*)/| [~\1~](\4) | \2 |/;
371+
s/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
344372
rm -f $CHECKS_TEMP_FILE
345373
346374
- name: Close PR
@@ -458,18 +486,26 @@ jobs:
458486
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
459487
run: |
460488
CHECKS_TEMP_FILE="$(mktemp)"
489+
trap 'EXIT_CODE=$?; echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT; exit $EXIT_CODE' EXIT
490+
461491
sleep 10
462-
gh pr checks --watch >> $CHECKS_TEMP_FILE
463-
sleep 10
464-
gh pr checks --watch >> $CHECKS_TEMP_FILE
492+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
493+
while [ $PENDING -ne 0 ]
494+
do
495+
echo "::group::Pending checks: $PENDING"
496+
gh pr checks --watch
497+
sleep 10
498+
PENDING=$(gh pr checks | cut -f2 | grep pending | wc -l)
499+
echo "::endgroup::"
500+
done
501+
gh pr checks >> $CHECKS_TEMP_FILE
465502
echo "::notice::Temp file content:
466503
467504
$(cat $CHECKS_TEMP_FILE)
468505
"
469-
echo "checks-temp-file=$CHECKS_TEMP_FILE" >> $GITHUB_OUTPUT
470506
471507
- name: Report Checks
472-
if: ${{ steps.check-pr.outputs.checks-temp-file != '' }}
508+
if: ${{ always() && steps.check-pr.outputs.checks-temp-file != '' }}
473509
env:
474510
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
475511
BASE_PR_NUMBER: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
@@ -480,7 +516,13 @@ jobs:
480516
481517
| Check | Status |
482518
| --- | --- |
483-
$(cat $CHECKS_TEMP_FILE | grep -E 'https://' | tac | awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' | sed -E 's/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
519+
$(cat $CHECKS_TEMP_FILE |
520+
grep -E 'https://' |
521+
tac |
522+
awk 'BEGIN { FS ="\t" } ; { if (! seen[$1]++) print }' |
523+
sed -E 's/(.*)\t(pass)\t(.*)\t(.*)\t(.*)/| [**\1**](\4) | \2 |/;
524+
s/(.*)\t(skipping)\t(.*)\t(.*)\t(.*)/| [~\1~](\4) | \2 |/;
525+
s/(.*)\t(.*)\t(.*)\t(.*)\t(.*)/| [\1](\4) | \2 |/')"
484526
rm -f $CHECKS_TEMP_FILE
485527
486528
- name: Close PR

0 commit comments

Comments
 (0)