1
1
name : CI
2
2
on :
3
- push : {}
4
- pull_request : {}
5
- schedule :
6
- - cron : " 0 12 * * 1" # Every Monday at 12:00 UTC
3
+ pull_request :
4
+ merge_group :
7
5
8
6
env :
9
7
AWS_ACCESS_KEY_ID : AKIA46X5W6CZEAQSMRH7
10
8
11
9
jobs :
12
- rustfmt :
13
- name : Rustfmt
14
- runs-on : ubuntu-latest
15
- steps :
16
- - uses : actions/checkout@master
17
- - name : Install Rust
18
- run : rustup update stable && rustup default stable && rustup component add rustfmt
19
- - run : cargo fmt --all --check
20
-
21
10
test :
22
11
name : Test
23
12
runs-on : ubuntu-latest
@@ -38,15 +27,16 @@ jobs:
38
27
- uses : Swatinem/rust-cache@v2
39
28
- name : Run tests
40
29
run : cargo test --workspace --all-targets
30
+ - name : Check formatting
31
+ run : cargo fmt --all --check
41
32
42
- ci :
43
- name : CI
33
+ deploy :
34
+ name : Deploy
44
35
runs-on : ubuntu-latest
36
+ if : github.event_name == 'merge_group'
45
37
steps :
46
38
- name : Checkout the source code
47
- uses : actions/checkout@v2
48
- with :
49
- fetch-depth : 1
39
+ uses : actions/checkout@v4
50
40
51
41
- name : Test and build
52
42
run : docker build -t triagebot .
61
51
redeploy_ecs_service : triagebot
62
52
aws_access_key_id : " ${{ env.AWS_ACCESS_KEY_ID }}"
63
53
aws_secret_access_key : " ${{ secrets.AWS_SECRET_ACCESS_KEY }}"
64
- 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