From fb076de69c437b31f417a12d034ea6a7af234c05 Mon Sep 17 00:00:00 2001 From: igneum-josh <337424239+igneum-josh@users.noreply.github.com> Date: Mon, 5 Oct 2026 17:45:09 +0100 Subject: [PATCH] ci: no conflict markers in tracked files (check + pre-push hook that also builds the site) Co-Authored-By: Claude Fable 5.1 --- .github/workflows/ci.yml | 2 ++ tools/ci/install-hooks.sh | 12 ++++++++++++ tools/ci/no-conflict-markers.sh | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100755 tools/ci/install-hooks.sh create mode 100755 tools/ci/no-conflict-markers.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d37d7dc5..41af14874 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 000000000..f138ab7c5 --- /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 000000000..de3c2913b --- /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"