Skip to content

Commit

Permalink
Introduce zizmor (#605)
Browse files Browse the repository at this point in the history
* Introduce zizmor

* harden workflows
  • Loading branch information
Tinche authored Nov 30, 2024
1 parent c3596e4 commit 3cc9419
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

steps:
- uses: "actions/checkout@v4"
with:
persist-credentials: false

- uses: "pdm-project/setup-pdm@v4"
with:
Expand Down Expand Up @@ -48,6 +50,8 @@ jobs:

steps:
- uses: "actions/checkout@v4"
with:
persist-credentials: false

- uses: "actions/setup-python@v5"
with:
Expand Down Expand Up @@ -104,6 +108,8 @@ jobs:

steps:
- uses: "actions/checkout@v4"
with:
persist-credentials: false
- uses: "pdm-project/setup-pdm@v4"
with:
python-version: "3.12"
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/pypi-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:
- published
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
build-package:
name: Build & verify package
Expand All @@ -23,6 +19,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: hynek/build-and-inspect-python-package@v1

Expand All @@ -33,6 +30,8 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build-package
permissions:
id-token: write

steps:
- name: Download packages built by build-and-inspect-python-package
Expand All @@ -53,6 +52,8 @@ jobs:
if: github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package
permissions:
id-token: write

steps:
- name: Download packages built by build-and-inspect-python-package
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# https://github.com/woodruffw/zizmor
name: Zizmor

on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

permissions:
contents: read


jobs:
zizmor:
name: Zizmor latest via Cargo
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get zizmor
run: cargo install zizmor
- name: Run zizmor
run: zizmor --format sarif . > results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
# Optional category for the results
# Used to differentiate multiple results for one commit
category: zizmor

0 comments on commit 3cc9419

Please sign in to comment.