name: GitHub Actions Security Analysis with zizmor 🌈

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["**"]

permissions: {}

jobs:
  zizmor:
    name: zizmor latest via PyPI
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      # required for workflows in private repositories
      contents: read
      actions: read
    steps:
      - name: Checkout repository
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
        with:
          persist-credentials: false

      - name: Install the latest version of uv
        uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba

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

      - name: Upload SARIF file
        uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b
        with:
          sarif_file: results.sarif
          category: zizmor