pre-commit hook with stages: [manual] never runs in CI
A hook restricted to stages: [manual] only runs when you invoke that stage explicitly. A normal pre-commit run --all-files skips it, so a gate you expected to enforce is silently absent in CI.
What this error means
A hook you configured never appears in the CI output, or a hook you meant to run only manually is executing on every run. The stages value controls this.
pre-commit
# expected the security scan to run in CI, but the log shows only:
black....................................................................Passed
isort....................................................................Passed
# the manual-stage hook was never invokedCommon causes
A required hook is limited to the manual stage
With stages: [manual], the hook is excluded from the default run and only fires when you call the manual stage explicitly.
The CI step does not target the intended stage
CI runs the default stage, so any hook scoped to a different stage is skipped.
How to fix it
Run the hook stage you intend in CI
- Decide which stage the hook should run in.
- Either broaden its
stagesor invoke the manual stage in CI. - Confirm the hook now appears in the log.
.github/workflows/ci.yml
- run: pre-commit run --hook-stage manual --all-filesAdjust the stages in the config
Include the stage the CI job runs so the hook is not skipped.
.pre-commit-config.yaml
- id: security-scan
stages: [pre-commit, manual]How to prevent it
- Match each hook
sstages` to where you want it enforced. - Use
--hook-stage manualin CI for manual-only hooks. - Audit that every expected hook appears in the CI log.
Related guides
pre-commit SKIP env silently skips hooks in CIFix pre-commit hooks being skipped by the SKIP environment variable in CI - a leftover SKIP value disables th…
pre-commit only checks changed files in CI (missing --all-files)Fix pre-commit checking only changed files in CI - without --all-files pre-commit runs against the staged dif…
pre-commit local hooks misconfigured in CIFix pre-commit local hooks failing in CI - a `repo: local` entry is missing the id, name, entry, or language…