Skip to content

Commit ddbe6f6

Browse files
committed
update comments and details of branch protection 'success' job
1 parent bb6d9d5 commit ddbe6f6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ jobs:
5454

5555
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
5656
# protection, rather than having to add each job separately.
57+
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
5758
success:
5859
name: Success
5960
runs-on: ubuntu-latest
6061
needs: [test-core, test-alloc, test-std, test-simd, test-stdarch]
61-
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
62-
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
63-
# dependencies fails.
64-
if: always() # make sure this is never "skipped"
62+
# We need to ensure this job does *not* get skipped if its dependencies fail,
63+
# because a skipped job is considered a success by Github. So we have to
64+
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
65+
# when the workflow is canceled manually.
66+
if: ${{ !cancelled() }}
6567
steps:
6668
# Manually check the status of all dependencies. `if: failure()` does not work.
6769
- name: check if any dependency failed
68-
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
70+
run: |
71+
# Print the dependent jobs to see them in the CI log
72+
jq -C <<< '${{ toJson(needs) }}'
73+
# Check if all jobs that we depend on (in the needs array) were successful.
74+
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
6975
7076
# Make a PR to update `rust-version` when the cron job succeeds.
7177
# The primary reason for this is that Github stops running our cron job

0 commit comments

Comments
 (0)