Files
yellowjacket/lefthook.yml
T
logan 5f22be6ed2 ci: add pre-push hook to prevent direct pushes to main (#33)
* ci: add pre-push hook to prevent direct pushes to main

* ci: grant pull-requests read permission to commitlint job
2026-02-14 00:12:18 -06:00

52 lines
1.2 KiB
YAML

# lefthook.yml — local git hooks for yellowjacket
# Install with: lefthook install
# Docs: https://github.com/evilmartians/lefthook
pre-commit:
parallel: true
commands:
go-vet:
glob: "*.go"
run: go vet -tags webkit2_41 ./...
golangci-lint:
glob: "*.go"
run: golangci-lint run --timeout 5m --build-tags webkit2_41 ./...
codegen-check:
glob: "*.{go,sql,templ}"
run: |
go generate ./...
if [ -n "$(git diff --name-only)" ]; then
echo "Generated code is out of date. Run 'make generate' and stage the changes."
git diff --stat
exit 1
fi
frontend-typecheck:
glob: "frontend/**/*.{ts,tsx}"
root: "frontend/"
run: pnpm exec tsc --noEmit
pre-push:
parallel: true
commands:
protect-main:
run: |
while read local_ref local_sha remote_ref remote_sha; do
if [ "$remote_ref" = "refs/heads/main" ]; then
echo "Direct push to main is not allowed. Use a pull request instead."
exit 1
fi
done
skip:
- merge
- rebase
go-test:
glob: "*.go"
run: go test -tags webkit2_41 -race -count=1 -timeout 120s ./...
go-mod-verify:
run: go mod verify