name: Security audit

on:
  push:
    paths:
      - '**/Cargo.toml'
      - '**/Cargo.lock'

  pull_request:
    paths:
      - '**/Cargo.toml'
      - '**/Cargo.lock'

  schedule:
  - cron: '12 12 12 * *'

env:
  RUST_LOG: info
  RUST_BACKTRACE: 1

jobs:
  security_audit:
    runs-on: ubuntu-latest
    permissions:
      checks: write
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Install Rust Toolchain
      uses: hecrj/setup-rust-action@v2
      with:
        rust-version: stable
        profile: minimal

    - name: Install Audit
      run: cargo install cargo-audit
      
    - name: Run cargo-audit
      run: cargo audit
