Skip to content

Commit 75fffb0

Browse files
committed
fix(ci): Skip cancelled runs in failure reporting
When a CI run is cancelled (e.g., superseded by a newer push), status jobs were incorrectly reporting "build failed" because the outcome was empty/cancelled rather than success. Now all status jobs check for cancelled state and exit cleanly without error annotations or artifact uploads. Also updated ci-failure-comment.yml to only trigger on actual failures, not cancelled runs.
1 parent 68651fd commit 75fffb0

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

.github/workflows/ci-failure-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
post-failure-comment:
4141
if: >
4242
github.event.workflow_run.event == 'pull_request' &&
43-
github.event.workflow_run.conclusion != 'success'
43+
github.event.workflow_run.conclusion == 'failure'
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Get PR number

.github/workflows/linux-build-base.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,12 @@ jobs:
328328
name: "BUILD: Linux release with adapters"
329329
steps:
330330
- run: |
331+
if [[ -z "$BUILD_OUTCOME" || "$BUILD_OUTCOME" == "cancelled" ]]; then
332+
echo "Build was cancelled (likely superseded by a newer push). Skipping."
333+
exit 0
334+
fi
331335
if [[ "$BUILD_OUTCOME" != "success" ]]; then
332-
echo "::error::Linux adapters release build failed or was cancelled. Do not land this PR until the build is fixed."
336+
echo "::error::Linux adapters release build failed. Do not land this PR until the build is fixed."
333337
exit 1
334338
fi
335339
echo "Build succeeded."
@@ -366,10 +370,18 @@ jobs:
366370
name: "TEST: Linux release with adapters"
367371
steps:
368372
- run: |
373+
if [[ -z "$BUILD_OUTCOME" || "$BUILD_OUTCOME" == "cancelled" ]]; then
374+
echo "Run was cancelled (likely superseded by a newer push). Skipping."
375+
exit 0
376+
fi
369377
if [[ "$BUILD_OUTCOME" != "success" ]]; then
370-
echo "::error::Build failed or was cancelled — tests did not run. Check the 'Linux release with adapters' build job for compiler errors and build logs."
378+
echo "::error::Build failed — tests did not run. Check the 'Linux release with adapters' build job for compiler errors and build logs."
371379
exit 1
372380
fi
381+
if [[ -z "$TEST_OUTCOME" || "$TEST_OUTCOME" == "cancelled" ]]; then
382+
echo "Tests were cancelled (likely superseded by a newer push). Skipping."
383+
exit 0
384+
fi
373385
if [[ "$TEST_OUTCOME" != "success" ]]; then
374386
if [[ -n "$FAILED_CASES" ]]; then
375387
CASE_LIST=$(echo "$FAILED_CASES" | sed 's/^/ - /')
@@ -663,8 +675,12 @@ jobs:
663675
name: "BUILD: Ubuntu debug with system dependencies"
664676
steps:
665677
- run: |
678+
if [[ -z "$BUILD_OUTCOME" || "$BUILD_OUTCOME" == "cancelled" ]]; then
679+
echo "Build was cancelled (likely superseded by a newer push). Skipping."
680+
exit 0
681+
fi
666682
if [[ "$BUILD_OUTCOME" != "success" ]]; then
667-
echo "::error::Ubuntu debug build failed or was cancelled. Do not land this PR until the build is fixed."
683+
echo "::error::Ubuntu debug build failed. Do not land this PR until the build is fixed."
668684
exit 1
669685
fi
670686
echo "Build succeeded."
@@ -701,10 +717,18 @@ jobs:
701717
name: "TEST: Ubuntu debug with system dependencies"
702718
steps:
703719
- run: |
720+
if [[ -z "$BUILD_OUTCOME" || "$BUILD_OUTCOME" == "cancelled" ]]; then
721+
echo "Run was cancelled (likely superseded by a newer push). Skipping."
722+
exit 0
723+
fi
704724
if [[ "$BUILD_OUTCOME" != "success" ]]; then
705-
echo "::error::Build failed or was cancelled — tests did not run. Check the 'Ubuntu debug with system dependencies' build job for compiler errors and build logs."
725+
echo "::error::Build failed — tests did not run. Check the 'Ubuntu debug with system dependencies' build job for compiler errors and build logs."
706726
exit 1
707727
fi
728+
if [[ -z "$TEST_OUTCOME" || "$TEST_OUTCOME" == "cancelled" ]]; then
729+
echo "Tests were cancelled (likely superseded by a newer push). Skipping."
730+
exit 0
731+
fi
708732
if [[ "$TEST_OUTCOME" != "success" ]]; then
709733
if [[ -n "$FAILED_CASES" ]]; then
710734
CASE_LIST=$(echo "$FAILED_CASES" | sed 's/^/ - /')
@@ -881,8 +905,12 @@ jobs:
881905
name: "BUILD: Fedora debug"
882906
steps:
883907
- run: |
908+
if [[ -z "$BUILD_OUTCOME" || "$BUILD_OUTCOME" == "cancelled" ]]; then
909+
echo "Build was cancelled (likely superseded by a newer push). Skipping."
910+
exit 0
911+
fi
884912
if [[ "$BUILD_OUTCOME" != "success" ]]; then
885-
echo "::error::Fedora debug build failed or was cancelled. Do not land this PR until the build is fixed."
913+
echo "::error::Fedora debug build failed. Do not land this PR until the build is fixed."
886914
exit 1
887915
fi
888916
echo "Build succeeded."

0 commit comments

Comments
 (0)