Skip to content

Commit 38edb2c

Browse files
committed
Split cargo-deny job into two non-matrix jobs
Instead of conditionally applying `continue-on-error: true` at the job level to the `advisories` job, this splits `cargo-deny` into two job definitions, `cargo-deny-advisories` and `cargo-deny`, where *neither* has `continue-on-error` but `cargo-deny-advisories` is omitted as a dependency of the `tests-pass` job that makes jobs effectively required for PR auto-merge. This way, when there is an unaddressed advisory, the `cargo-deny-advisories` job unambiguously fails, even failing the workflow, but PRs can still auto-merge. One implication of this is that, on Dependabot security update PRs, `@dependabot merge` and `@dependabot squash and merge` commands will only perform a merge if `cargo deny check advisories` reports no other outstanding advisories. This is because, when Dependabot is told to merge a PR, it only goes ahead with the merge if all checks pass (i.e. report a successful conclusion). This would be convenient for cases where, if the fix is not complete, further manual review is desired. It would otherwise be inconvenient, but then a usual PR auto-merge could be done instead (which is the more common practice here anyway).
1 parent 5173e9a commit 38edb2c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

.github/workflows/ci.yml

+12-9
Original file line numberDiff line numberDiff line change
@@ -192,23 +192,25 @@ jobs:
192192
# than allows is no problem either if it comes to that.
193193
continue-on-error: true
194194

195-
cargo-deny:
195+
# This job is not required for PR auto-merge, so that sudden announcement of a
196+
# new advisory does not keep otherwise OK pull requests from being integrated.
197+
cargo-deny-advisories:
196198
runs-on: ubuntu-latest
197199

198-
strategy:
199-
matrix:
200-
checks:
201-
- advisories
202-
- bans licenses sources
200+
steps:
201+
- uses: actions/checkout@v4
202+
- uses: EmbarkStudios/cargo-deny-action@v2
203+
with:
204+
command: check advisories
203205

204-
# Prevent sudden announcement of a new advisory from failing ci:
205-
continue-on-error: ${{ matrix.checks == 'advisories' }}
206+
cargo-deny:
207+
runs-on: ubuntu-latest
206208

207209
steps:
208210
- uses: actions/checkout@v4
209211
- uses: EmbarkStudios/cargo-deny-action@v2
210212
with:
211-
command: check ${{ matrix.checks }}
213+
command: check bans licenses sources
212214

213215
wasm:
214216
name: WebAssembly
@@ -300,6 +302,7 @@ jobs:
300302
# List all jobs that are intended NOT to block PR auto-merge here.
301303
EXPECTED_NONBLOCKING_JOBS: |-
302304
test-fixtures-windows
305+
cargo-deny-advisories
303306
wasm
304307
tests-pass
305308

0 commit comments

Comments
 (0)