|
1 |
| -# Please make sure that the `needs` fields for both `end-success` and `end-failure` |
| 1 | +# Please make sure that the `needs` field for the `conclusion` job |
2 | 2 | # are updated when adding new jobs!
|
3 | 3 |
|
4 | 4 | name: CI
|
5 | 5 | on:
|
6 | 6 | pull_request:
|
7 |
| - push: |
8 |
| - branches: |
9 |
| - - auto |
10 |
| - - try |
11 |
| - - automation/bors/try |
| 7 | + merge_group: |
12 | 8 |
|
13 | 9 | env:
|
14 | 10 | CARGO_INCREMENTAL: 0
|
@@ -237,20 +233,21 @@ jobs:
|
237 | 233 | - name: check for typos
|
238 | 234 | run: typos
|
239 | 235 |
|
240 |
| - end-success: |
241 |
| - name: bors build finished |
242 |
| - if: github.event.pusher.name == 'bors' && success() |
243 |
| - runs-on: ubuntu-latest |
| 236 | + conclusion: |
244 | 237 | needs: [rust, rust-cross, typescript, typo-check]
|
245 |
| - steps: |
246 |
| - - name: Mark the job as successful |
247 |
| - run: exit 0 |
248 |
| - |
249 |
| - end-failure: |
250 |
| - name: bors build finished |
251 |
| - if: github.event.pusher.name == 'bors' && !success() |
| 238 | + # We need to ensure this job does *not* get skipped if its dependencies fail, |
| 239 | + # because a skipped job is considered a success by GitHub. So we have to |
| 240 | + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run |
| 241 | + # when the workflow is canceled manually. |
| 242 | + # |
| 243 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 244 | + if: ${{ !cancelled() }} |
252 | 245 | runs-on: ubuntu-latest
|
253 |
| - needs: [rust, rust-cross, typescript, typo-check] |
254 | 246 | steps:
|
255 |
| - - name: Mark the job as a failure |
256 |
| - run: exit 1 |
| 247 | + # Manually check the status of all dependencies. `if: failure()` does not work. |
| 248 | + - name: Conclusion |
| 249 | + run: | |
| 250 | + # Print the dependent jobs to see them in the CI log |
| 251 | + jq -C <<< '${{ toJson(needs) }}' |
| 252 | + # Check if all jobs that we depend on (in the needs array) were successful. |
| 253 | + jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |
0 commit comments