Skip to content

ci: migrate the template repo's own hooks from pre-commit to prek#61

Merged
tsvikas merged 1 commit into
mainfrom
switch-to-prek
Jul 14, 2026
Merged

ci: migrate the template repo's own hooks from pre-commit to prek#61
tsvikas merged 1 commit into
mainfrom
switch-to-prek

Conversation

@tsvikas

@tsvikas tsvikas commented Jul 14, 2026

Copy link
Copy Markdown
Owner

What

The generated project already uses prek (prek-action in CI, prek in its justfile), but the template repo itself still linted with pre-commit. This aligns the two so the template dogfoods what it ships.

  • CI: replace the pre-commit job (pre-commit/action) with a prek job using j178/prek-action, the same action and pin the generated project uses (ci.yml.jinja). This also drops the Node 20 deprecation annotation that pre-commit/action's internal actions/cache@v4 was triggering.
  • justfile: prepare / lint / deps-update now call prek instead of pre-commit.
  • deps: swap the pre-commit dev dependency for prek ~=0.4.0 and relock.

Why it's safe

prek is config-compatible: it reads the same .pre-commit-config.yaml. Verified locally that every hook passes against the template's own config, full parity with pre-commit. The sync-pre-commit-deps call and the config filename are unchanged (prek reads that same file).

Notes

  • Follow-up to ci: cache prek instead of pre-commit in copier-template-tester #60 (which fixed the copier-template-tester cache path). That PR handled the rendered projects' prek cache; this one migrates the template repo's own tooling.
  • deps-update keeps the existing -j <nproc> job-count detection for a faithful behavioral swap (prek's auto-update accepts -j). The generated justfile uses a plainer prek auto-update; harmonizing them is left as an optional follow-up.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VnSA7mKDr3hkDCxZeUvFZY

The generated project already uses prek (prek-action in CI, prek in its
justfile), but the template repo itself still linted with pre-commit. Align
the two so the template dogfoods what it ships.

- CI: replace the pre-commit job (pre-commit/action) with a prek job using
  j178/prek-action, the same action and pin the generated project uses.
- justfile: prepare/lint/deps-update now call prek instead of pre-commit.
- deps: swap the pre-commit dev dependency for prek ~=0.4.0 and relock.

prek is config-compatible: it reads the same .pre-commit-config.yaml, and
every hook passes against the template's own config. The sync-pre-commit-deps
call and the config filename are unchanged (prek reads that same file).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VnSA7mKDr3hkDCxZeUvFZY
@tsvikas
tsvikas marked this pull request as ready for review July 14, 2026 12:45

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@tsvikas
tsvikas merged commit 90bce0d into main Jul 14, 2026
5 checks passed
@tsvikas
tsvikas deleted the switch-to-prek branch July 14, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant