hyperhive/scripts/pre-push
atlas bf8e309b19 ops: add CI lint for Co-Authored-By/Claude/Anthropic trailers
Three builder runs tonight carried a Co-Authored-By: Claude trailer
despite bold instructions forbidding it. A rule in a prompt is not a
control — this gate is. Flags commits in a PR's range carrying
co-authored-by + (claude OR anthropic OR noreply@anthropic.com),
case-insensitive, covering all observed spellings.

Wired into CI (new attribution-trailer job) and pre-push hook. Mirrors
existing lint scripts in structure and exit conventions. Pattern tested
against all three variants plus a normal commit.
2026-09-16 00:07:02 +02:00

44 lines
1.5 KiB
Shell
Executable file

#!/bin/sh
# Git pre-push hook: runs the tracker-tag, comment-block and doc-pointer
# lints against the working tree before any push lands on the remote.
# Catches issues that would fail CI and require a follow-up commit
# (common failure mode: a nix comment containing a hash-issue-number
# tag added mid-session).
#
# Install (once per clone):
# ln -sf ../../scripts/pre-push .git/hooks/pre-push
#
# The hook runs against the full working tree (not just staged or
# pushed files) to match what CI sees: `nix flake check` builds from
# the committed tree, so an untracked hit on a staged file would still
# trip CI.
set -eu
repo_root="$(git rev-parse --show-toplevel)"
echo "pre-push: running tracker-tag lint..." >&2
if ! sh "$repo_root/scripts/check-issue-refs.sh"; then
echo "pre-push: tracker-tag lint FAILED — fix before pushing" >&2
exit 1
fi
echo "pre-push: running comment-block lint..." >&2
if ! sh "$repo_root/scripts/check-comment-blocks.sh"; then
echo "pre-push: comment-block lint FAILED — fix before pushing" >&2
exit 1
fi
echo "pre-push: running doc-pointer lint..." >&2
if ! sh "$repo_root/scripts/check-doc-refs.sh"; then
echo "pre-push: doc-pointer lint FAILED — fix before pushing" >&2
exit 1
fi
echo "pre-push: running attribution-trailer lint..." >&2
if ! sh "$repo_root/scripts/check-attribution-trailers.sh"; then
echo "pre-push: attribution-trailer lint FAILED — fix before pushing" >&2
exit 1
fi
echo "pre-push: lints passed ✓" >&2
exit 0