File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 2222
2323 - name : Run zizmor 🌈
2424 uses : zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
25+
26+ - name : Fail job on zizmor findings
27+ if : always()
28+ env :
29+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30+ run : |
31+ # Only enforce on pull requests; pushes to main will still upload alerts but not fail CI
32+ if [ "${{ github.event_name }}" != "pull_request" ]; then
33+ echo "Not a pull_request event, skipping zizmor enforcement."
34+ exit 0
35+ fi
36+
37+ REF="${{ github.event.pull_request.head.sha }}"
38+ REPO="${{ github.repository }}"
39+
40+ echo "Checking zizmor code scanning alerts for ref $REF in $REPO"
41+
42+ # Fetch code scanning alerts for this ref and tool 'zizmor'
43+ ALERTS_JSON=$(gh api \
44+ "repos/$REPO/code-scanning/alerts" \
45+ --method GET \
46+ -f ref="$REF" \
47+ -f tool_name="zizmor" 2>/dev/null || echo "[]")
48+
49+ COUNT=$(echo "$ALERTS_JSON" | jq 'length')
50+
51+ echo "zizmor alerts for this ref: $COUNT"
52+
53+ if [ "$COUNT" -gt 0 ]; then
54+ echo "::error::zizmor reported $COUNT security alerts on this PR. Failing job."
55+ exit 1
56+ fi
57+
58+ echo "No zizmor alerts found for this PR; job will pass."
You can’t perform that action at this time.
0 commit comments