name: Security audit

on:
  schedule:
    - cron: "0 0 */3 * *"

  push:
    branches: [main]
    paths:
      - "**/Cargo.toml"
      - "**/Cargo.lock"

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

jobs:
  audit:
    name: Audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

      - name: Install cargo-audit
        uses: taiki-e/install-action@28a9d316db64b78a951f3f8587a5d08cc97ad8eb # v2.65.6
        with:
          tool: cargo-audit

      - name: Run audit
        run: cargo audit
