Skip to content

build(msrv)!: require Rust 1.98.0 #275

build(msrv)!: require Rust 1.98.0

build(msrv)!: require Rust 1.98.0 #275

Workflow file for this run

name: "Audit dependencies"
on:
push:
branches: ["main"]
paths:
- .github/workflows/audit.yml
- "**/Cargo.toml"
- "**/Cargo.lock"
- rust-toolchain.toml
pull_request:
paths:
- .github/workflows/audit.yml
- "**/Cargo.toml"
- "**/Cargo.lock"
- rust-toolchain.toml
schedule:
- cron: "0 6 * * 1" # Monday at 6 AM UTC
workflow_dispatch:
concurrency:
group: >
audit-${{ github.workflow }}-${{
github.event_name == 'pull_request' &&
github.event.pull_request.number ||
github.ref
}}
cancel-in-progress: true
permissions:
actions: read
contents: read
security-events: write
jobs:
audit:
runs-on: ubuntu-latest
env:
CARGO_AUDIT_VERSION: "0.22.2"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true # toolchain/components are specified in rust-toolchain.toml
cache-bin: false
- name: Cache audit database
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cargo/advisory-db
key: advisory-db-${{ github.ref_name }}-v1
restore-keys: advisory-db-
- name: Install cargo-audit
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: cargo-audit@${{ env.CARGO_AUDIT_VERSION }}
- name: Run cargo audit
id: audit
run: |
set +e
cargo audit --format sarif > audit-results.sarif
sarif_status=$?
cargo audit --json > audit-results.json
json_status=$?
cargo audit
text_status=$?
set -e
exit_code=0
if ((sarif_status != 0 || json_status != 0 || text_status != 0)); then
exit_code=1
fi
echo "exit_code=$exit_code" >> "$GITHUB_OUTPUT"
exit 0
- name: Upload audit SARIF results
if: >-
always() &&
hashFiles('audit-results.sarif') != '' &&
(
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
)
uses: github/codeql-action/upload-sarif@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
sarif_file: audit-results.sarif
category: cargo-audit
wait-for-processing: true
- name: Upload audit results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: audit-results
path: |
audit-results.json
audit-results.sarif
- name: Fail on audit findings
if: steps.audit.outputs.exit_code != '0'
run: exit 1