Repository navigation
ci(pre-commit): protect main and versions/ branches from direct commits - #845
Conversation
Adds the no-commit-to-branch hook from pre-commit-hooks, blocking direct commits to main and any versions/* branch. Runs on pre-commit.ci and locally via `pre-commit run`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is minimal, correctly scoped to the pre-commit-hooks repo at a recent pinned rev, and introduces no behavioral risk beyond the intended branch-commit protection.
Pull request overview
Adds a pre-commit safeguard to prevent developers from making direct local commits onto protected branches (main and versions/*), aligning local workflows with typical branch protection policies and reducing accidental bypass of PR review.
Changes:
- Add
no-commit-to-branchhook (frompre-commit-hooks) to block direct commits tomain. - Extend the protection to any maintenance branch matching
^versions/.*. - Ensure this runs both locally via
pre-commitand in pre-commit.ci runs.
File summaries
| File | Description |
|---|---|
| .pre-commit-config.yaml | Adds no-commit-to-branch hook args to protect main and versions/* branches from direct commits. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
always_run is already the hook's shipped default, but setting it explicitly documents that this hook intentionally ignores any files/exclude/types filtering (and would still allow --allow-empty commits through). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #845 +/- ##
=======================================
Coverage 96.32% 96.32%
=======================================
Files 164 164
Lines 6769 6769
=======================================
Hits 6520 6520
Misses 249 249 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
no-commit-to-branchhook from pre-commit-hooks to.pre-commit-config.yamlmain(--branch main) and anyversions/*maintenance branch (--pattern ^versions/.*) from direct commitspre-commit run) and on pre-commit.ciTest plan
argsshape against the same change already merged in unxt#929, coordinax#881, jaxmore#26, quaxed#213, quax-blocks#64🤖 Generated with Claude Code