File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,20 +25,39 @@ jobs:
2525 with :
2626 online-audits : true
2727
28- - name : Run zizmor (plain output for PR comment )
28+ - name : Build zizmor PR report (changed files only )
2929 if : github.event_name == 'pull_request'
30- id : zizmor_plain
3130 continue-on-error : true
31+ env :
32+ NO_COLOR : " 1"
33+ GH_TOKEN : ${{ github.token }}
34+ REPO : ${{ github.repository }}
35+ PR_NUMBER : ${{ github.event.pull_request.number }}
3236 run : |
33- pipx install zizmor
37+ # List workflow/action YAML files changed in this PR (skip removed files).
38+ gh api "repos/$REPO/pulls/$PR_NUMBER/files" --paginate \
39+ --jq '.[] | select(.status != "removed") | .filename' \
40+ | grep -E '^\.github/(workflows|actions)/.*\.ya?ml$' \
41+ > changed_files.txt || true
42+
3443 {
35- echo '## :shield: zizmor security findings'
44+ echo '## :shield: zizmor findings on workflow/action files changed in this PR '
3645 echo ''
3746 echo 'Rule descriptions and remediation guidance: <https://docs.zizmor.sh/audits/>'
3847 echo ''
39- echo '```'
40- zizmor --persona=auditor --format=plain . 2>&1 || true
41- echo '```'
48+ if [ ! -s changed_files.txt ]; then
49+ echo '_No workflow or action YAML files changed in this PR — nothing to scan._'
50+ else
51+ echo 'Scanned:'
52+ while IFS= read -r file; do
53+ echo "- \`$file\`"
54+ done < changed_files.txt
55+ echo ''
56+ echo '```'
57+ pipx install zizmor
58+ xargs zizmor --persona=auditor --format=plain < changed_files.txt 2>/dev/null || true
59+ echo '```'
60+ fi
4261 } > zizmor-report.md
4362
4463 - name : Post zizmor findings as sticky PR comment
You can’t perform that action at this time.
0 commit comments