diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d37d7dc..41af1487 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,8 @@ jobs: run: node tools/ci/link-check.mjs - name: identity grep of the public export list run: bash tools/ci/identity-check.sh + - name: no conflict markers in tracked files + run: bash tools/ci/no-conflict-markers.sh - name: copied sources are re-stamped before a build run: bash tools/ci/copied-sources-check.sh - name: pinned guest programs match their manifest and are built only by pin-guests.sh diff --git a/tools/ci/install-hooks.sh b/tools/ci/install-hooks.sh new file mode 100755 index 00000000..f138ab7c --- /dev/null +++ b/tools/ci/install-hooks.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Installs the repository's git hooks into this checkout (pre-push: no conflict markers, the site builds). +set -euo pipefail +cd "$(dirname "$0")/../.." +cat > .git/hooks/pre-push <<'HOOK' +#!/usr/bin/env bash +set -e +cd "$(git rev-parse --show-toplevel)" +bash tools/ci/no-conflict-markers.sh +(cd site && node build.mjs >/dev/null) || { echo "pre-push: the site build fails; fix it before pushing" >&2; exit 1; } +HOOK +chmod +x .git/hooks/pre-push; echo "pre-push hook installed" diff --git a/tools/ci/no-conflict-markers.sh b/tools/ci/no-conflict-markers.sh new file mode 100755 index 00000000..de3c2913 --- /dev/null +++ b/tools/ci/no-conflict-markers.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# No tracked file may carry a merge conflict marker. 5 October 2026: a marker in the generated site/journey.json broke +# `node build.mjs` silently for two merges and a half-merged home page went live for a few minutes. Runs in CI and +# before every push from the main checkout (git hook installed by tools/ci/install-hooks.sh). +set -euo pipefail +cd "$(dirname "$0")/../.." +hits="$(git ls-files -z | xargs -0 grep -lE '^(<<<<<<< |=======$|>>>>>>> )' 2>/dev/null | grep -vE '^tools/ci/no-conflict-markers\.sh$' || true)" +if [ -n "$hits" ]; then echo "conflict markers in:"; echo "$hits" | sed 's/^/ /'; exit 1; fi +echo "no conflict markers in tracked files"