6e7710282c
## Summary `lefthook.yml` has been in the repo since #4147, but nothing installs lefthook and nothing runs `lefthook install`, so the pre-push hook it describes has never fired for anyone. #3977 had removed the `lefthook` devDependency a week before #4147 landed, and #4147 only added the config file. This supplies the missing half: ```diff + "prepare": "lefthook install", + "lefthook": "^2.1.10", "onlyBuiltDependencies": [ + "lefthook", ``` With those in place, `pnpm install` wires the hook up on clone, and the format and lint checks actually run before a push instead of first failing in CI. Also here: the pre-push jobs run in parallel rather than in sequence, and `CONTRIBUTING.md` documents the hook, including how to skip it and the fact that GitButler only runs hooks when "Run hooks" is enabled in its settings. `lefthook@2.1.10` is the current release.
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
pre-commit:
|
|
only:
|
|
- ref: main
|
|
jobs:
|
|
- name: 🚫 Prevent main branch commits
|
|
run: exit 1
|
|
|
|
# Mirror the CI code-quality check locally so unformatted / lint-failing pushes
|
|
# are caught before they hit the PR. Note: GitButler uses its own git
|
|
# implementation and only runs hooks when "Run hooks" is enabled in its
|
|
# settings - with that off, this protects plain `git push` only.
|
|
pre-push:
|
|
parallel: true
|
|
jobs:
|
|
- name: format
|
|
run: |
|
|
pnpm exec oxfmt --check . || {
|
|
echo ""
|
|
echo "✖ Formatting issues found. Fix them with:"
|
|
echo ""
|
|
echo " pnpm run format"
|
|
echo ""
|
|
echo " then stage the changes and re-push."
|
|
echo ""
|
|
exit 1
|
|
}
|
|
- name: lint
|
|
run: |
|
|
pnpm exec oxlint . || {
|
|
echo ""
|
|
echo "✖ Lint errors found. Auto-fix what's fixable with:"
|
|
echo ""
|
|
echo " pnpm run lint:fix"
|
|
echo ""
|
|
echo " then review, stage, and re-push (some rules need a manual fix)."
|
|
echo ""
|
|
exit 1
|
|
}
|