mirror of
https://github.com/coder/coder.git
synced 2026-06-03 21:18:24 +00:00
660a3dad21
The pre-push hook was removed in #22956. This restores it with a reduced scope (tests + site build) and an allowlist so it only runs for developers who opt in. Two opt-in mechanisms: - git config coder.pre-push true (local, not committed) - CODER_WORKSPACE_OWNER_NAME allowlist in the hook script git config takes priority and also supports explicit opt-out for allowlisted users (git config coder.pre-push false). Refs #22956 --------- Co-authored-by: Cian Johnston <cian@coder.com>
24 lines
710 B
Bash
Executable File
24 lines
710 B
Bash
Executable File
#!/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.
|
|
# Heavier checks (tests, site build) run 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
|
|
|
|
# In linked worktrees, set worktree-scoped hooksPath to override shared config.
|
|
if [[ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ]]; then
|
|
git config --worktree core.hooksPath scripts/githooks
|
|
fi
|
|
exec make pre-commit
|