|
| 1 | +name: Periodic Zizmor |
| 2 | + |
| 3 | +permissions: {} |
| 4 | + |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + # Set to run once a day at 10:00 UTC |
| 8 | + - cron: "0 10 * * *" |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +jobs: |
| 14 | + zizmor: |
| 15 | + name: Run zizmor |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + repository: |
| 20 | + # - owner: grafana |
| 21 | + # repo: grafana |
| 22 | + # - owner: grafana |
| 23 | + # repo: loki |
| 24 | + # - owner: grafana |
| 25 | + # repo: tempo |
| 26 | + # - owner: grafana |
| 27 | + # repo: mimir |
| 28 | + - owner: grafana |
| 29 | + repo: security-github-actions |
| 30 | + |
| 31 | + env: |
| 32 | + ZIZMOR_VERSION: 1.6.0 |
| 33 | + MIN_SEVERITY: high |
| 34 | + MIN_CONFIDENCE: low |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + persist-credentials: false |
| 41 | + |
| 42 | + - name: Get GitHub App Secrets |
| 43 | + uses: grafana/shared-workflows/actions/[email protected] |
| 44 | + with: |
| 45 | + common_secrets: | |
| 46 | + ZIZMOR_APP_ID=zizmor:app-id |
| 47 | + ZIZMOR_PRIVATE_KEY=zizmor:private-key |
| 48 | + export_env: false |
| 49 | + |
| 50 | + - name: Authenticate App With GitHub |
| 51 | + uses: actions/create-github-app-token@v2 |
| 52 | + id: get-token |
| 53 | + with: |
| 54 | + app-id: ${{ fromJson(steps.get-secrets.outputs.secrets).ZIZMOR_APP_ID }} |
| 55 | + private-key: ${{ fromJson(steps.get-secrets.outputs.secrets).ZIZMOR_PRIVATE_KEY }} |
| 56 | + owner: ${{ matrix.repository.owner }} |
| 57 | + repositories: | |
| 58 | + ${{ matrix.repository.repo }} |
| 59 | +
|
| 60 | + - name: Checkout Target |
| 61 | + uses: actions/checkout@v4 |
| 62 | + with: |
| 63 | + repository: ${{ matrix.repository.owner }}/${{ matrix.repository.repo }} |
| 64 | + token: ${{ steps.get-token.outputs.token }} |
| 65 | + path: target |
| 66 | + |
| 67 | + - name: Setup UV |
| 68 | + uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1 |
| 69 | + with: |
| 70 | + enable-cache: true |
| 71 | + activate-environment: true |
| 72 | + cache-suffix: ${{ env.ZIZMOR_VERSION }} |
| 73 | + cache-dependency-glob: "" |
| 74 | + |
| 75 | + - name: Run zizmor |
| 76 | + env: |
| 77 | + ZIZMOR_CACHE_DIR: ${{ runner.temp }}/.cache/zizmor |
| 78 | + REPOSITORY: ${{ matrix.repository.owner }}/${{ matrix.repository.repo }} |
| 79 | + GH_TOKEN: ${{ steps.get-token.outputs.token }} |
| 80 | + shell: sh |
| 81 | + run: >- |
| 82 | + uvx zizmor@"${ZIZMOR_VERSION}" |
| 83 | + --format sarif |
| 84 | + --min-severity "${MIN_SEVERITY}" |
| 85 | + --min-confidence "${MIN_CONFIDENCE}" |
| 86 | + --config .github/zizmor.yml |
| 87 | + ./target |
| 88 | + > results.sarif |
| 89 | +
|
| 90 | + - name: Upload SARIF results |
| 91 | + uses: github/codeql-action/[email protected] |
| 92 | + with: |
| 93 | + sarif_file: ./results.sarif |
| 94 | + token: ${{ steps.get-token.outputs.token }} |
| 95 | + checkout_path: ./target |
0 commit comments