Skip to content

ci(pre-commit): protect main and versions/ branches from direct commits - #35

Merged
nstarman merged 2 commits into
mainfrom
add-no-commit-to-branch
Sep 15, 2026
Merged

nstarman merged 2 commits into
mainfrom
add-no-commit-to-branch

Conversation

@nstarman

Copy link
Copy Markdown
Contributor

Summary

  • Adds the no-commit-to-branch hook from pre-commit-hooks to .pre-commit-config.yaml
  • Protects main (--branch main) and any versions/* maintenance branch (--pattern ^versions/.*) from direct commits
  • Runs both locally (pre-commit run) and on pre-commit.ci

Test plan

🤖 Generated with Claude Code

nstarman and others added 2 commits September 15, 2026 14:33
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>
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>
@nstarman
nstarman force-pushed the add-no-commit-to-branch branch from bbc72f7 to 316b6d9 Compare September 15, 2026 18:35
@nstarman nstarman added this to the v0.2.0 milestone Sep 15, 2026
@nstarman
nstarman merged commit f45ed52 into main Sep 15, 2026
22 of 24 checks passed
@nstarman
nstarman deleted the add-no-commit-to-branch branch September 15, 2026 23:32
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