name: Security audit

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

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

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

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

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - uses: actions-rs/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
