name: Zizmor on: push: branches: [main] pull_request: paths: - ".github/workflows/**/*.yml" schedule: # Run weekly - cron: "0 0 * * 0" workflow_dispatch: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: zizmor-analysis: name: Run Zizmor runs-on: ubuntu-latest permissions: contents: read security-events: write # allow uploading code scanning results steps: - name: Checkout repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: persist-credentials: false - name: Set up Rust uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 - name: Install jq run: | sudo apt-get update sudo apt-get install -y jq - name: Install Zizmor run: | cargo install --locked zizmor - name: Run Zizmor analysis run: | zizmor --persona auditor --format sarif .github/workflows/ > zizmor.sarif - name: Upload analysis results uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: zizmor-results path: zizmor.sarif retention-days: 7 - name: Upload to code-scanning uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: sarif_file: zizmor.sarif - name: Fail on Findings run: | count="$( jq '([.runs[]? | (.results // [])[] | select(.level != "note")] | length) // 0' \ zizmor.sarif )" echo "Zizmor findings: $count" test "$count" -eq 0