Repository navigation
chore: Add prek hooks - #953
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
we use https://github.com/j178/prek for some other sdks |
|
Sorry for the late reply @marandaneto. Thanks for pointing it out. Yes, of course, we can use prek. I have never used it. I will update the PR, shortly. |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Good call, switched to prek. It reads the same Verified locally with prek 0.5.7: |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| #!/bin/sh | ||
|
|
||
| # Skip protection if running in GitHub Actions | ||
| if [ "$GITHUB_ACTIONS" = "true" ]; then |
There was a problem hiding this comment.
💡 Motivation and Context
Hey! I noticed this repository doesn't use git prek hooks yet, so I put together a very minimal set as a starting point.
What's included
prek.tomlwith these built-in hooks:check-case-conflictcheck-merge-conflictcheck-symlinkscheck-xmlcheck-yamldetect-private-keyprotect-main-branchpre-push hook (scripts/check-protected-branch.sh, same as posthog-js) that rejects pushes while onmain. It is skipped in GitHub Actions.make bootstrapnow installsprekand runsprek install, which installs both the pre-commit and pre-push hooksHooks are opt-in per clone, and CI stays the source of truth.
💚 How did you test it?
prek validate-config prek.tomlandprek run --all-files; the hooks pass on the current tree.protect-main-branchpasses on a feature branch, fails onmainwith exit 1, and exits 0 whenGITHUB_ACTIONS=true.prek installinstalls both.git/hooks/pre-commitand.git/hooks/pre-pushin a fresh clone.brew install prekandprek installbootstrap lines directly. A fullmake bootstraprun stopped earlier atgem install cocoapodsdue to system Ruby permissions on my machine, unrelated to this change.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileNot needed: tooling-only change, no releasable SDK change.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Drafted with Claude Code at the author's direction. The hook set was kept intentionally small.
🤖 Generated with Claude Code