yams/.githooks/pre-push
Trevon 34b61b226b
ci(release): reconcile draft promotion safely (#113)
* ci(release): reconcile draft promotion

Create promotion visibility independently of release readiness.
Leave existing PRs untouched to preserve concurrent maintainer edits.
Validate against current main without masking candidate rejection.

Signed-off-by: trvon <me@trevon.dev>

* ci: isolate hook Git environments

Prevent temporary Git fixtures from modifying the calling worktree.
Clear repository-local hook variables before the unchanged build gates,
and isolate validator and fixture Git subprocesses from caller overrides.
Exercise linked-worktree config, ref and index preservation offline.

Signed-off-by: trvon <me@trevon.dev>

---------

Signed-off-by: trvon <me@trevon.dev>
2026-09-07 11:34:31 -04:00

42 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
# Git exports repository-local overrides to hooks. Do not let test fixtures in
# temporary directories inherit this worktree's refs, index or shared config.
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 [ "${YAMS_SKIP_PREPUSH_CI_GATE:-0}" != "1" ]; then
gate_args=()
if [ "${YAMS_PREPUSH_GATE_SELF_TEST:-0}" = "1" ]; then
gate_args+=(--self-test)
fi
if [ -n "${YAMS_PREPUSH_GATE_ARGS:-}" ]; then
# shellcheck disable=SC2206
extra_args=(${YAMS_PREPUSH_GATE_ARGS})
gate_args+=("${extra_args[@]}")
fi
if [ "${#gate_args[@]}" -gt 0 ]; then
"$REPO_ROOT/scripts/local-ci/pre-push-ci-gate.sh" "${gate_args[@]}"
else
"$REPO_ROOT/scripts/local-ci/pre-push-ci-gate.sh"
fi
else
echo "[pre-push] YAMS_SKIP_PREPUSH_CI_GATE=1; skipping host sanitizer CI gate" >&2
fi
if [ "${YAMS_PREPUSH_COVERAGE:-0}" = "1" ]; then
"$REPO_ROOT/scripts/run-local-coverage.sh" "$@"
else
echo "[pre-push] coverage gate skipped; set YAMS_PREPUSH_COVERAGE=1 to run it" >&2
fi
if [ "${YAMS_PREPUSH_GH_LANE:-0}" = "1" ]; then
PROFILE="${YAMS_PREPUSH_GH_PROFILE:-fast}"
"$REPO_ROOT/scripts/local-ci/push-lane.sh" --profile "${PROFILE}"
fi