mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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`.
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Pre-commit hook that runs CI-equivalent checks locally.
|
||||
# Runs `make pre-commit` (gen, fmt, lint, typos, build) which
|
||||
# catches most CI failures without needing Docker or Playwright.
|
||||
# The full CI suite (including tests) runs via the pre-push hook.
|
||||
#
|
||||
# Installation (worktree-compatible):
|
||||
#
|
||||
# git config core.hooksPath scripts/githooks
|
||||
#
|
||||
# Bypass: git commit --no-verify
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
unset GIT_DIR
|
||||
|
||||
exec make pre-commit
|
||||
Reference in New Issue
Block a user