Skip to content

Commit

Permalink
Add a success job to CI for branch protection
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Dec 28, 2024
1 parent 9bd1af8 commit 1dff477
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,17 @@ jobs:
rustup update --no-self-update
- run: cargo build

success:
needs:
- test
- msrv
runs-on: ubuntu-latest
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

0 comments on commit 1dff477

Please sign in to comment.