Skip to content

Commit c5efaef

Browse files
committed
Switch CI to use merge queue
1 parent b688119 commit c5efaef

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

.github/workflows/ci.yml

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
on:
3-
push: {}
4-
pull_request: {}
3+
pull_request:
4+
merge_group:
55

66
env:
77
AWS_ACCESS_KEY_ID: AKIA46X5W6CZEAQSMRH7
@@ -30,9 +30,10 @@ jobs:
3030
- name: Check formatting
3131
run: cargo fmt --all --check
3232

33-
ci:
34-
name: CI
33+
deploy:
34+
name: Deploy
3535
runs-on: ubuntu-latest
36+
if: github.event_name == 'merge_group'
3637
steps:
3738
- name: Checkout the source code
3839
uses: actions/checkout@v4
@@ -50,4 +51,22 @@ jobs:
5051
redeploy_ecs_service: triagebot
5152
aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}"
5253
aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
53-
if: github.ref == 'refs/heads/master'
54+
55+
# Summary job for the merge queue.
56+
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
57+
ci:
58+
needs: [ test, deploy ]
59+
# We need to ensure this job does *not* get skipped if its dependencies fail,
60+
# because a skipped job is considered a success by GitHub. So we have to
61+
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
62+
# when the workflow is canceled manually.
63+
if: ${{ !cancelled() }}
64+
runs-on: ubuntu-latest
65+
steps:
66+
# Manually check the status of all dependencies. `if: failure()` does not work.
67+
- name: Conclusion
68+
run: |
69+
# Print the dependent jobs to see them in the CI log
70+
jq -C <<< '${{ toJson(needs) }}'
71+
# Check if all jobs that we depend on (in the needs array) were successful.
72+
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)