File tree Expand file tree Collapse file tree 2 files changed +22
-20
lines changed Expand file tree Collapse file tree 2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,17 @@ jobs:
68
68
components : rustfmt
69
69
- run : cargo fmt --all --check
70
70
71
- ci-success :
72
- name : Complete
71
+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
72
+ # protection, rather than having to add each job separately.
73
+ success :
74
+ name : Success
73
75
runs-on : ubuntu-latest
74
76
needs : [test, i586, no_std, fmt]
77
+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
78
+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
79
+ # dependencies fails.
80
+ if : always() # make sure this is never "skipped"
75
81
steps :
76
- - run : exit 0
77
- ci-failed :
78
- name : Complete
79
- runs-on : ubuntu-latest
80
- needs : [test, i586, no_std, fmt]
81
- if : failure()
82
- steps :
83
- - run : exit 1
82
+ # Manually check the status of all dependencies. `if: failure()` does not work.
83
+ - name : check if any dependency failed
84
+ 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
- uses : actions/checkout@v4
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