From 354fe057a9c4f7693f9c5ca2e3dc4453932e6647 Mon Sep 17 00:00:00 2001 From: david morales <118213696+davidmoralesz@users.noreply.github.com> Date: Mon, 5 Oct 2026 22:31:22 -0600 Subject: [PATCH] chore(devtools): check the branch name and PR size before push --- README.md | 3 +++ lefthook.yml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index e710572..61f3a02 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,9 @@ pnpm installs the Node toolchain (commitlint, Prettier, lefthook, semantic-relea git hooks; Homebrew adds actionlint, zizmor, shellcheck and gitleaks. The hooks warn and skip when a linter is missing, so a fresh clone can always commit — CI has no such escape hatch. +On push, the hooks also check the branch name and the 20-file limit, with the same scripts `ci-pr` +runs on the pull request. + ## Contributing [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and diff --git a/lefthook.yml b/lefthook.yml index d2890ba..ec2396b 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -5,6 +5,7 @@ # review: # commit-msg -> Conventional Commits (commitlint) # pre-commit -> Prettier, then the four linters ci-workflows runs +# pre-push -> Conventional Branch name and the PR size limit (ci-pr) # # Prettier and commitlint are devDependencies, so they are always present. The # linters are system tools: the guards below warn and skip when one is missing @@ -76,3 +77,18 @@ pre-commit: action-pins: glob: '{.github/workflows,workflow-templates}/*.{yml,yaml}' run: sh .devtools/check-action-pins.sh + +# The same two scripts ci-pr runs, and the ones `.pre-commit-hooks.yaml` offers to +# consumers. Without them here this repo was the one place a bad branch name was +# first reported by CI, after the pull request was already open. +# +# Both check the branch that is checked out, not the ref being pushed, which is +# the same thing in every push but `git push origin `. +pre-push: + parallel: true + commands: + branch-name: + run: bash .devtools/check-branch-name.sh + + pr-size: + run: bash .devtools/check-pr-size.sh