Skip to content

Commit

Permalink
Add zizmor pre-commit hook (#195)
Browse files Browse the repository at this point in the history
* Add zizmor pre-commit hook, update remaining hooks

via `pre-commit autoupdate`.

* Add `persist-credentials: false` to actions/checkout uses, fix up mike action

Based on zizmor's findings.

Fixing mike works by supplying the shell command-line inputs as envvars, since
they are always fully expanded by the shell, preventing surprise injections at
the template level.
  • Loading branch information
nicholasjng authored Jan 8, 2025
1 parent f6f72ae commit 92e02c6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .github/actions/mike-docs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ runs:
shell: bash
- env:
DOCS_PRERELEASE: ${{ inputs.pre_release }}
INPUTS_PUSH: ${{ inputs.push }}
INPUTS_VERSION: ${{ inputs.version }}
INPUTS_ALIAS: ${{ inputs.alias }}
run: |
MIKE_OPTIONS=( "--update-aliases" )
if [ "true" = "${{ inputs.push }}" ]; then
if [ "true" = "${INPUTS_PUSH}" ]; then
MIKE_OPTIONS+=( "--push" )
fi
uv run mike deploy ${{ inputs.version }} ${{ inputs.alias }} "${MIKE_OPTIONS[@]}"
uv run mike deploy "${INPUTS_VERSION}" ${INPUTS_ALIAS} "${MIKE_OPTIONS[@]}"
shell: bash
5 changes: 5 additions & 0 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand All @@ -30,6 +32,8 @@ jobs:
python-version: [ "3.10", 3.11, 3.12, 3.13 ]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand All @@ -43,6 +47,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
types_or: [ python, pyi ]
args: [--ignore-missing-imports, --explicit-package-bases]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.10
rev: 0.5.15
hooks:
- id: uv-lock
name: Lock project dependencies
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.0.1
hooks:
- id: zizmor
args: [--min-severity=medium]

0 comments on commit 92e02c6

Please sign in to comment.