chore: add zizmor pre-commit hook for GitHub Actions workflow compliance#972
Merged
jkowalleck merged 2 commits intocopilot/chore-harden-github-workflowsfrom Apr 28, 2026
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +0.00% coverage variation |
| Diff coverage | ✅ ∅ diff coverage (80.00%) |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (8ad0fd2) 5950 5603 94.17% Head commit (bfc42e7) 5950 (+0) 5603 (+0) 94.17% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#972) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Agent-Logs-Url: https://github.com/CycloneDX/cyclonedx-python-lib/sessions/d045a5ae-58e3-446e-b2c0-85b6b42846b5 Co-authored-by: jkowalleck <2765863+jkowalleck@users.noreply.github.com>
jkowalleck
approved these changes
Apr 28, 2026
ab7f3b5
into
copilot/chore-harden-github-workflows
44 checks passed
Copilot
AI
changed the title
[WIP] Add pre-commit hook for GitHub Actions compliance checking
chore: add zizmor pre-commit hook for GitHub Actions workflow compliance
Apr 28, 2026
Copilot stopped work on behalf of
jkowalleck due to an error
April 28, 2026 13:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
zizmorcore/zizmor-pre-committo.pre-commit-config.yamlto statically analyse GitHub Actions workflows for security issues locally, complementing the existing CI zizmor workflow..pre-commit-config.yaml: appends the zizmor hook as a remote repo entry (installed via PyPI wheels — no Rust toolchain required)No workflow files are modified; this is a dev-tooling-only change.
Original prompt
Create a new branch
copilot/zizmor-pre-commit-hookfromcopilot/chore-harden-github-workflowsinCycloneDX/cyclonedx-python-lib.In that new branch, update
.pre-commit-config.yamlto add the following pre-commit repo hook (no extra args, keep minimal config):Integrate it into the existing file’s structure.
Then open a pull request targeting the base branch
copilot/chore-harden-github-workflows.The pull request description MUST follow the repository’s PR/ticket template. Locate the template file (commonly
.github/pull_request_template.md,.github/PULL_REQUEST_TEMPLATE.md, or similar) and populate it appropriately for this change.Notes/constraints:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: zizmor is a crate, right? how would this be installed?
Assistant: Yes—zizmor is a Rust crate / CLI, not a Python package. So
deps = zizmorin tox will not work (tox “deps” are pip-installable Python packages).You have a few workable installation patterns; the right one depends on what you want to require from contributors:
Option A (recommended): install via
cargo(Rust toolchain)cargo install zizmorzizmor ...(or verify it exists)This is the most “native” for a Rust CLI, but it requires contributors to have Rust installed.
Option B: install a prebuilt binary in CI/dev (e.g., GitHub Releases)
zizmorbinary for the OS/arch and put it onPATH.zizmor ....Good for CI, but for local dev you need a helper script (curl/wget) and handling for macOS/Linux/Windows.
Option C: run via a container (Docker)
docker run ... zizmor ...How I’d wire this into tox (keeping “all logic in tox”)
Create a tox env that:
zizmorexists, and.github/workflows.Example shape:
Then your pre-commit hook remains:
Key concern
Because zizmor isn’t pip-installable, tox cannot automatically provision it unless you add a custom “download/install zizmor” step (script) or require
cargo installas a prerequisite.If you want, I can suggest a concrete “bootstrap” approach (e.g., a small
scripts/install-zizmor.shthat downloads a pinned release) so contributors don’t need Rust, and tox can call that script before running zizmor.User: so there is no need for a python wrapper, right?
Assistant: Right—there’s no need for a Python wrapper just to use zizmor as a pre-commit check.
Because zizmor is a standalone CLI, the clean approach is:
zizmorbinary is available onPATH(installed viacargo install zizmoror downloaded as a pinned prebuilt binary), andzizmordirectly.A Python wrapper would only be useful if you specifically want extra behavior, like:
But for “just scan workflows for compliance (read-only)”, invoking the CLI directly is sufficient and simpler.
User: ```
rev: v1.23.1
hooks:
Assistant: That config is the simplest/cleanest way to add zizmor to pre-commit if
zizmorcore/zizmor-pre-commitis a proper pre-commit hook repo (i.e., it contains a.pre-commit-hooks.yamland handles installing/running zizmor). In that case, pre-commit will manage fetching the hook atrev: v1.23.1, and you don’t need tox or a local/system hook for it.Concerns / things to verify before adopting it:
repo: local+language: systemhooks.v1.23.1is good.This pull request was created from Copilot chat.