# Generated by /setup-meerkat — safe to delete; re-run the skill to recreate it.
#
# Arm: dependency audit (osv-scanner). The scanner's own exit code is the gate: a
# finding at or above the project's threshold fails this job. A waiver is a recorded
# decision in the project's standard — docs/tech-spec.md § Security toolchain — never
# an edit to this file.
#
# Every `uses:` ref below is pinned to the commit this skill shipped with. Re-check
# them when you upgrade the skill; pinning to a tag would let a new release run here
# unreviewed.

name: security-dependency-audit

on:
  pull_request:
  schedule:
    - cron: "17 3 * * 1"
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: security-dependency-audit-${{ github.ref }}
  cancel-in-progress: true

jobs:
  dependency-audit:
    name: Dependency audit (osv-scanner)
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with:
          fetch-depth: 1

      # --recursive finds every lockfile and SBOM in the tree. No continue-on-error:
      # the scanner exits non-zero on a finding, and that is the gate.
      - name: osv-scanner
        uses: google/osv-scanner-action/osv-scanner-action@e69cc6c86b31f1e7e23935bbe7031b50e51082de # v2.0.2
        with:
          scan-args: |-
            --recursive
            --format=json
            --output=osv-results.json
            ./

      - name: Upload the report
        if: always()
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
        with:
          name: dependency-audit-report
          path: osv-results.json
          if-no-files-found: ignore
          retention-days: 30
