Debian Codegraph @

.github/workflows/zizmor.yml

raw
1 name: Zizmor
2
3 on:
4 push:
5 branches: [main]
6 pull_request:
7 paths:
8 - ".github/workflows/**/*.yml"
9 schedule:
10 # Run weekly
11 - cron: "0 0 * * 0"
12 workflow_dispatch:
13
14 permissions:
15 contents: read
16
17 concurrency:
18 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19 cancel-in-progress: true
20
21 jobs:
22 zizmor-analysis:
23 name: Run Zizmor
24 runs-on: ubuntu-latest
25 permissions:
26 contents: read
27 security-events: write # allow uploading code scanning results
28
29 steps:
30 - name: Checkout repository
31 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
32 with:
33 persist-credentials: false
34
35 - name: Set up Rust
36 uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659
37 - name: Install jq
38 run: |
39 sudo apt-get update
40 sudo apt-get install -y jq
41 - name: Install Zizmor
42 run: |
43 cargo install --locked zizmor
44
45 - name: Run Zizmor analysis
46 run: |
47 zizmor --persona auditor --format sarif .github/workflows/ > zizmor.sarif
48
49 - name: Upload analysis results
50 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
51 with:
52 name: zizmor-results
53 path: zizmor.sarif
54 retention-days: 7
55
56 - name: Upload to code-scanning
57 uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
58 with:
59 sarif_file: zizmor.sarif
60
61 - name: Fail on Findings
62 run: |
63 count="$(
64 jq '([.runs[]? | (.results // [])[] | select(.level != "note")] | length) // 0' \
65 zizmor.sarif
66 )"
67 echo "Zizmor findings: $count"
68 test "$count" -eq 0