Skip to content

Commit fbc8ba8

Browse files
authored
Merge pull request #14718 from Kobzol/ci-remove-bors
Switch CI from bors to merge queue
2 parents cb088dc + 92cf813 commit fbc8ba8

File tree

1 file changed

+26
-37
lines changed

1 file changed

+26
-37
lines changed

.github/workflows/main.yml

+26-37
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: CI
22
on:
3-
push:
4-
branches:
5-
- auto-cargo
6-
- try
7-
- automation/bors/try
3+
merge_group:
84
pull_request:
95
branches:
106
- "**"
@@ -17,46 +13,39 @@ permissions:
1713
contents: read
1814

1915
concurrency:
20-
group: "${{ github.workflow }}-${{ (github.ref == 'refs/heads/try' && github.sha) || github.ref }}"
16+
group: "${{ github.workflow }}-${{ github.ref }}"
2117
cancel-in-progress: true
2218

2319
jobs:
24-
success:
25-
permissions:
26-
contents: none
27-
name: bors build finished
20+
conclusion:
2821
needs:
29-
- build_std
30-
- clippy
31-
- msrv
32-
- docs
33-
- lockfile
34-
- resolver
35-
- rustfmt
36-
- test
37-
- test_gitoxide
38-
runs-on: ubuntu-latest
39-
if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/auto-cargo' || github.ref == 'refs/heads/try') && github.repository == 'rust-lang/cargo'"
40-
steps:
41-
- run: echo ok
42-
failure:
22+
- build_std
23+
- clippy
24+
- msrv
25+
- docs
26+
- lockfile
27+
- resolver
28+
- rustfmt
29+
- test
30+
- test_gitoxide
4331
permissions:
4432
contents: none
45-
name: bors build finished
46-
needs:
47-
- build_std
48-
- clippy
49-
- msrv
50-
- docs
51-
- lockfile
52-
- resolver
53-
- rustfmt
54-
- test
55-
- test_gitoxide
33+
# We need to ensure this job does *not* get skipped if its dependencies fail,
34+
# because a skipped job is considered a success by GitHub. So we have to
35+
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
36+
# when the workflow is canceled manually.
37+
#
38+
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
39+
if: ${{ !cancelled() }}
5640
runs-on: ubuntu-latest
57-
if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/auto-cargo' || github.ref == 'refs/heads/try') && github.repository == 'rust-lang/cargo'"
5841
steps:
59-
- run: exit 1
42+
# Manually check the status of all dependencies. `if: failure()` does not work.
43+
- name: Conclusion
44+
run: |
45+
# Print the dependent jobs to see them in the CI log
46+
jq -C <<< '${{ toJson(needs) }}'
47+
# Check if all jobs that we depend on (in the needs array) were successful.
48+
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
6049
6150
# Check Code style quickly by running `rustfmt` over all code
6251
rustfmt:

0 commit comments

Comments
 (0)