@@ -270,33 +270,32 @@ jobs:
270270 # erroring about invalid credentials instead.
271271 if : success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
272272
273- # These jobs don't actually test anything, but they're used to tell bors the
274- # build completed, as there is no practical way to detect when a workflow is
275- # successful listening to webhooks only.
276- try-success :
277- needs : [ job ]
278- if : " success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
279- << : *base-success-job
280- try-failure :
281- needs : [ job ]
282- if : " !success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
283- << : *base-failure-job
284- auto-success :
273+ # This job isused to tell bors the final status of the build, as there is no practical way to detect
274+ # when a workflow is successful listening to webhooks only in our current bors implementation (homu).
275+ outcome :
276+ name : bors build finished
277+ runs-on : ubuntu-latest
285278 needs : [ job ]
286- if : " success () && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust' "
287- << : *base-outcome-job
279+ # !cancelled () executes the job regardless of whether the previous jobs passed or failed
280+ if : " !cancelled() && github.event_name == 'push' "
288281 steps :
289282 - name : checkout the source code
290283 uses : actions/checkout@v4
291284 with :
292285 fetch-depth : 2
286+ # Calculate the exit status of the whole CI workflow (0 if all dependent jobs were either successful
287+ # or skipped, otherwise 1).
288+ - name : calculate the correct exit status
289+ id : status
290+ run : |
291+ jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'
292+ echo "status=$?" >> $GITHUB_OUTPUT
293+ # Publish the toolstate if an auto build succeeds (just before push to master)
293294 - name : publish toolstate
294295 run : src/ci/publish_toolstate.sh
295296 shell : bash
297+ if : steps.outputs.status == 0 && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
296298 env :
297299 TOOLSTATE_REPO_ACCESS_TOKEN : ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
298-
299- auto-failure :
300- needs : [ job ]
301- if : " !success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
302- << : *base-failure-job
300+ - name : set the correct exit status
301+ run : exit ${{ steps.outputs.status }}
0 commit comments