Files
coder/scripts/githooks/pre-push
T
Mathias Fredriksson 752e6ecc16 build: add pre-commit/push hooks mirroring CI checks (#22705)
This change adds git hooks and Makefile targets that mirror CI required
checks locally, catching issues before they reach CI.

This is for use by AI agents (documented in AGENTS.md).

- **pre-commit** (every commit): gen, fmt, lint, typos, slim binary
  build. Fast checks without Docker or Playwright.
- **pre-push** (before push): full CI suite including site build, tests,
  sqlc-vet, offlinedocs.
  
To use:

```sh
git config core.hooksPath scripts/githooks
```

Works in worktrees (where `.git` is a file). Bypass with `--no-verify`.
2026-03-06 16:56:11 +02:00

23 lines
571 B
Bash
Executable File

#!/usr/bin/env bash
#
# Pre-push hook that runs the full CI suite locally.
# Runs `make pre-push` (gen, fmt, lint, typos, build, tests)
# to catch issues before they reach CI.
#
# The pre-commit hook already runs the lite checks on each commit.
# This hook adds the heavier checks (test-postgres, test-js,
# test-e2e, sqlc-vet, offlinedocs) before pushing.
#
# Installation (worktree-compatible):
#
# git config core.hooksPath scripts/githooks
#
# Bypass: git push --no-verify
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
unset GIT_DIR
exec make pre-push