name: zizmor

on:
    push:
      paths:
        - '.github/workflows/*.ya?ml'
    pull_request:
      paths:
        - '.github/workflows/*.ya?ml'

jobs:
  zizmor:
    name: zizmor latest via PyPI
    runs-on: ubuntu-24.04
    permissions:
      security-events: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
        with:
          persist-credentials: false

      - name: Install the latest version of uv
        uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4

      - name: Run zizmor 🌈
        run: uvx zizmor --format sarif . > results.sarif 
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 

      - name: Upload SARIF file
        uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
        with:
          sarif_file: results.sarif
          category: zizmor
