Skip to content

Commit cc7ac7d

Browse files
committed
fix(audit-workflow): update audit workflow
- remove master branch filter - fix invalid pinned SHA - remove Swatinem/rust-cache action
1 parent 956b717 commit cc7ac7d

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

.github/workflows/audit.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,65 @@
11
name: Security Audit
22

33
on:
4-
pull_request:
4+
push:
55
paths:
66
- '**/Cargo.toml'
77
- '**/Cargo.lock'
8-
merge_group:
9-
push:
10-
branches: [master]
8+
pull_request:
119
paths:
1210
- '**/Cargo.toml'
1311
- '**/Cargo.lock'
1412
schedule:
1513
# weekly
1614
- cron: '0 0 * * 0'
15+
workflow_dispatch:
1716

1817
env:
1918
CARGO_TERM_COLOR: always
2019

2120
permissions:
22-
contents: read
23-
security-events: write
24-
issues: write
21+
contents: read
22+
security-events: write
23+
issues: write
2524

2625
jobs:
2726
cargo-audit:
2827
name: RustSec Audit (vulnerabilities)
2928
runs-on: ubuntu-latest
3029
timeout-minutes: 15
30+
3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
3434

3535
- name: Install Rust toolchain
36-
uses: dtolnay/rust-toolchain@stable
36+
id: toolchain
37+
uses: dtolnay/rust-toolchain@v1
38+
with:
39+
toolchain: stable
3740

38-
- name: Cache cargo registry/index/target
39-
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1
41+
- name: Cache Cargo registry + target
42+
uses: actions/cache@v4
4043
with:
41-
cache-on-failure: true
44+
path: |
45+
~/.cargo/bin
46+
~/.cargo/registry/index
47+
~/.cargo/registry/cache
48+
~/.cargo/git/db
49+
target
50+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ steps.toolchain.outputs.cachekey }}
51+
restore-keys: |
52+
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-
53+
${{ runner.os }}-cargo-
4254
4355
- name: Install cargo-audit
4456
run: cargo install cargo-audit --locked
4557

46-
- name: Run cargo audit (raw output — you will see this clearly)
47-
run: cargo audit --deny warnings
48-
49-
- name: Run cargo audit again for GitHub Security tab upload
50-
uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212ae3e3c0d700
58+
- name: Run cargo audit
59+
run: cargo audit --deny warnings
60+
61+
- name: Upload SARIF to GitHub Security tab
62+
uses: rustsec/audit-check@v2.0.0
5163
with:
5264
token: ${{ secrets.GITHUB_TOKEN }}
5365
deny: warnings
54-

0 commit comments

Comments
 (0)