name: audit-check

on:
  push:
    paths:
      - '**/Cargo.lock'
      - '**/Cargo.toml'
      - 'deny.toml'
      - ".github/workflows/audit-check.yml"
  pull_request:
    paths:
      - '**/Cargo.lock'
      - '**/Cargo.toml'
      - 'deny.toml'
      - ".github/workflows/audit-check.yml"

env:
  CARGO_TERM_COLOR: always

jobs:

  cargo-deny:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses

    # Prevent sudden announcement of a new advisory from failing ci:
    continue-on-error: ${{ matrix.checks == 'advisories' }}

    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          command: check ${{ matrix.checks }}
