Skip to content

Commit 6b67c57

Browse files
authored
[ci] Fix all-jobs-succeeded job (#460)
Previously, this job used `if: success()` to only run on success. Unfortunately, GitHub interprets jobs skipped via `if:` to be successful. In this commit, we invert the logic, only running (and unconditionally failing) on `if: failure()`.
1 parent b38346b commit 6b67c57

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,14 @@ jobs:
451451
# Used to signal to branch protections that all other jobs have succeeded.
452452
all-jobs-succeed:
453453
name: All checks succeeded
454-
if: success()
454+
# On failure, we run and unconditionally exit with a failing status code.
455+
# On success, this job is skipped. Jobs skipped using `if:` are considered
456+
# to have succeeded:
457+
#
458+
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
459+
if: failure()
455460
runs-on: ubuntu-latest
456461
needs: [build_test, kani, check_fmt, check_readme, check_msrv, check_versions, generate_cache]
457462
steps:
458-
- name: Mark the job as successful
459-
run: exit 0
463+
- name: Mark the job as failed
464+
run: exit 1

0 commit comments

Comments
 (0)