pipe/scripts/pre-push-ci-gate.sh
trvon 567a0b8a45
Some checks failed
Tests / Static Analysis (push) Has been cancelled
Tests / Tests (push) Has been cancelled
chore: adopt the yams repo layout
Mirrors the conventions used in ../yams: a sectioned .gitignore, thin
.githooks dispatchers over runnable scripts/, release-please config and
manifest, conventional-commit linting, CODEOWNERS, a PR template with a
rule-precision checkbox, and tests + commitlint workflows. CI calls
scripts/lint.sh so local hooks and CI cannot drift.
2026-09-20 17:03:37 -06:00

27 lines
886 B
Bash
Executable file

#!/usr/bin/env bash
# Pre-push gate: nothing leaves this machine without formatting, analysis and
# tests passing. Mirrors the yams convention of a runnable local-CI script that
# the hook merely dispatches to.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
# Git exports repository-local overrides to hooks. Do not let anything spawned
# here inherit this worktree's refs or index.
git_local_env="$(git rev-parse --local-env-vars)"
while IFS= read -r git_env_name; do
unset "$git_env_name"
done <<< "$git_local_env"
unset git_local_env git_env_name
if [ "${PIPE_SKIP_PREPUSH_GATE:-0}" = "1" ]; then
echo "[pre-push] PIPE_SKIP_PREPUSH_GATE=1; skipping local CI gate" >&2
exit 0
fi
"$REPO_ROOT/scripts/lint.sh" format
"$REPO_ROOT/scripts/lint.sh" analyze
"$REPO_ROOT/scripts/lint.sh" test
echo "[pre-push] local CI gate passed"