From 9e6df79fce3cfd03ddb07fe84b1cb4637aa655b3 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:55:59 -0500 Subject: [PATCH] ci: add zizmor check action (#2306) This makes it so that if the `.github/workflows` directory is modified, we'll run `zizmor` to check things. This also fixes some zizmor warnings: - https://docs.zizmor.sh/audits/#self-repository - For now, mutes the secret inherits one; this will be fixed later. --- .github/workflows/ci.yml | 2 +- .github/workflows/deployment.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/nightly.yml | 4 +-- .github/workflows/post_release.yml | 2 +- .github/workflows/zizmor.yml | 40 ++++++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/zizmor.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0ec2ac6..87a20b4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,7 +324,7 @@ jobs: # *BSD targets run tests in a VM due to cross limitations. - name: Run tests (BSD) if: ${{ contains(matrix.info.checks, 'test') && contains(matrix.info.target, 'bsd') }} - uses: ./.github/actions/test-bsd-target + uses: $/.github/actions/test-bsd-target with: target: ${{ matrix.info.target }} os-version: ${{ matrix.info.os-version }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 2dee633e..660da453 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -48,7 +48,7 @@ jobs: id-token: write contents: read attestations: write - uses: ./.github/workflows/build_releases.yml + uses: $/.github/workflows/build_releases.yml # zizmor: ignore[secrets-inherit] with: caller: "deployment" secrets: inherit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aed6578f..040b5283 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -71,5 +71,5 @@ jobs: permissions: pages: write id-token: write - uses: ./.github/workflows/publish_github_pages.yml + uses: $/.github/workflows/publish_github_pages.yml # zizmor: ignore[secrets-inherit] secrets: inherit diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 37234158..879b3fed 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -55,7 +55,7 @@ jobs: id-token: write contents: read attestations: write - uses: ./.github/workflows/build_releases.yml + uses: $/.github/workflows/build_releases.yml # zizmor: ignore[secrets-inherit] with: caller: "nightly" secrets: inherit @@ -155,7 +155,7 @@ jobs: pages: write id-token: write contents: write - uses: ./.github/workflows/docs.yml + uses: $/.github/workflows/docs.yml # zizmor: ignore[secrets-inherit] secrets: inherit with: version: nightly diff --git a/.github/workflows/post_release.yml b/.github/workflows/post_release.yml index 1428937c..36ad3ccb 100644 --- a/.github/workflows/post_release.yml +++ b/.github/workflows/post_release.yml @@ -52,7 +52,7 @@ jobs: pages: write id-token: write contents: write - uses: ./.github/workflows/docs.yml + uses: $/.github/workflows/docs.yml # zizmor: ignore[secrets-inherit] secrets: inherit with: version: ${{ needs.initialize.outputs.version }} diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 00000000..ed375ff2 --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,40 @@ +# Runs Zizmor to verify GitHub workflows. + +name: Zizmor + +on: + workflow_dispatch: + pull_request: + paths: + - ".github/workflows/**" + push: + branches: + - main + paths: + - ".github/workflows/**" + +permissions: {} + +jobs: + zizmor: + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Enable Rust cache for Zizmor binary + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # 2.9.2 + if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork + with: + key: "zizmor" + cache-bin: true + + - name: Install Zizmor + run: cargo install --locked zizmor + + - name: Run Zizmor + run: zizmor ./