File tree 2 files changed +22
-20
lines changed 2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,17 @@ jobs:
43
43
components : rustfmt
44
44
- run : cargo fmt --all --check
45
45
46
- ci-success :
47
- name : Complete
46
+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
47
+ # protection, rather than having to add each job separately.
48
+ success :
49
+ name : Success
48
50
runs-on : ubuntu-latest
49
51
needs : [test, no_std, fmt]
52
+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
53
+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
54
+ # dependencies fails.
55
+ if : always() # make sure this is never "skipped"
50
56
steps :
51
- - run : exit 0
52
- ci-failed :
53
- name : Complete
54
- runs-on : ubuntu-latest
55
- needs : [test, no_std, fmt]
56
- if : failure()
57
- steps :
58
- - run : exit 1
57
+ # Manually check the status of all dependencies. `if: failure()` does not work.
58
+ - name : check if any dependency failed
59
+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Original file line number Diff line number Diff line change @@ -28,16 +28,17 @@ jobs:
28
28
components : rustfmt
29
29
- run : cargo fmt --all --check
30
30
31
- ci-success :
32
- name : Complete
31
+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
32
+ # protection, rather than having to add each job separately.
33
+ success :
34
+ name : Success
33
35
runs-on : ubuntu-latest
34
36
needs : [test, fmt]
37
+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
38
+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
39
+ # dependencies fails.
40
+ if : always() # make sure this is never "skipped"
35
41
steps :
36
- - run : exit 0
37
- ci-failed :
38
- name : Complete
39
- runs-on : ubuntu-latest
40
- needs : [test, fmt]
41
- if : failure()
42
- steps :
43
- - run : exit 1
42
+ # Manually check the status of all dependencies. `if: failure()` does not work.
43
+ - name : check if any dependency failed
44
+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
You can’t perform that action at this time.
0 commit comments