Skip to content

Commit 3c0e45b

Browse files
authored
🐛 fix(ci): repair pre-commit config and remaining zizmor findings (#26)
CI on `main` is red for every job because the `zizmor` hook added in #25 cannot parse `.pre-commit-config.yaml`. The file mixes 2- and 4-space list indentation, so pre-commit aborts with `InvalidConfigError` before any hook runs. 🔧 #25 also enabled `zizmor` without running it against `action.yml` or `.github/dependabot.yaml`, which carry five real findings: `astral-sh/setup-uv` and `actions/cache` are referenced by floating tag rather than commit SHA, `${{ inputs.extra_args }}` is interpolated directly into a `run:` block (template injection), and the Dependabot config has no `cooldown`. Pinning to SHAs matches the policy already applied in `.github/workflows/main.yml`. Moving `inputs.extra_args` into the step's `env:` and referencing it as `${INPUTS_EXTRA_ARGS}` removes the injection path while preserving word splitting, so callers passing multiple flags keep working. The workflow jobs are also renamed from `main-*` to `self-test-*` and the workflow gains a top-level `name: CI`, so PR status checks read as `CI / self-test-uvx` instead of `main / main-uvx`. ✨
1 parent d8eb059 commit 3c0e45b

4 files changed

Lines changed: 17 additions & 12 deletions

File tree

.github/dependabot.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ updates:
88
actions:
99
patterns:
1010
- "*"
11+
cooldown:
12+
default-days: 7

.github/workflows/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: CI
2+
13
on:
24
pull_request:
35
push:
@@ -7,15 +9,15 @@ permissions:
79
contents: read
810

911
jobs:
10-
main-uvx:
12+
self-test-uvx:
1113
runs-on: ubuntu-latest
1214
steps:
1315
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1416
with:
1517
persist-credentials: false
1618
- name: self test action (uvx path)
1719
uses: ./
18-
main-uv-run:
20+
self-test-uv-run:
1921
runs-on: ubuntu-latest
2022
steps:
2123
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -25,7 +27,7 @@ jobs:
2527
shell: bash
2628
- name: self test action (uv run path)
2729
uses: ./
28-
main-external-uv:
30+
self-test-external-uv:
2931
runs-on: ubuntu-latest
3032
steps:
3133
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v5.0.0
44
hooks:
5-
- id: trailing-whitespace
6-
- id: end-of-file-fixer
7-
- id: check-yaml
8-
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
98
- repo: https://github.com/zizmorcore/zizmor-pre-commit
109
rev: v1.23.1
1110
hooks:

action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ runs:
1919
shell: bash
2020
- name: Install the latest version of uv
2121
if: inputs.uv-install == 'true' || (inputs.uv-install == 'auto' && steps.check-uv.outputs.installed != 'true')
22-
uses: astral-sh/setup-uv@v7
22+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2323
with:
2424
enable-cache: true
2525
cache-dependency-glob: '.pre-commit-config.yaml'
2626
- run: uv run --isolated --no-sync true && echo "pythonLocation=$(uv python find)" >>$GITHUB_ENV
2727
shell: bash
28-
- uses: actions/cache@v5
28+
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
2929
with:
3030
path: ~/.cache/pre-commit
3131
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
3232
- run: |
3333
if [ -f pyproject.toml ]; then
34-
uv run --no-sync --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
34+
uv run --no-sync --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${INPUTS_EXTRA_ARGS}
3535
else
36-
uvx --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
36+
uvx --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${INPUTS_EXTRA_ARGS}
3737
fi
3838
shell: bash
39+
env:
40+
INPUTS_EXTRA_ARGS: ${{ inputs.extra_args }}

0 commit comments

Comments
 (0)