ci: no conflict markers in tracked files (check + pre-push hook that also builds the site)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-josh 2026-10-05 17:45:09 +01:00
parent ce6bdf404a
commit fb076de69c
3 changed files with 23 additions and 0 deletions

View file

@ -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

12
tools/ci/install-hooks.sh Executable file
View file

@ -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"

View file

@ -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"