Skip to content

Commit

Permalink
[ci] Fix all-jobs-succeeded job (google#460)
Browse files Browse the repository at this point in the history
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()`.
  • Loading branch information
joshlf authored Oct 4, 2023
1 parent b38346b commit 6b67c57
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,14 @@ jobs:
# Used to signal to branch protections that all other jobs have succeeded.
all-jobs-succeed:
name: All checks succeeded
if: success()
# On failure, we run and unconditionally exit with a failing status code.
# On success, this job is skipped. Jobs skipped using `if:` are considered
# to have succeeded:
#
# 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
if: failure()
runs-on: ubuntu-latest
needs: [build_test, kani, check_fmt, check_readme, check_msrv, check_versions, generate_cache]
steps:
- name: Mark the job as successful
run: exit 0
- name: Mark the job as failed
run: exit 1

0 comments on commit 6b67c57

Please sign in to comment.