Skip to content

Commit 85dd0ab

Browse files
Create pre-push
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
1 parent 7498b4e commit 85dd0ab

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.githooks/pre-push

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
# Palimpsest pre-push hook
4+
# Heavy validation: cross-links, SPDX, exhibits
5+
6+
echo "Running Palimpsest pre-push checks..."
7+
8+
# 1. Validate SPDX headers
9+
for file in $(git ls-files | grep -E '\.(adoc|txt)$'); do
10+
if ! grep -q "SPDX-License-Identifier:" "$file"; then
11+
echo "ERROR: Missing SPDX header in $file"
12+
exit 1
13+
fi
14+
done
15+
16+
# 2. Validate cross-links
17+
BROKEN_LINKS=0
18+
for link in $(grep -Rho "link:[^[]*" legal/ spec/ | sed 's/link://'); do
19+
if [ ! -f "$link" ]; then
20+
echo "ERROR: Broken link: $link"
21+
BROKEN_LINKS=1
22+
fi
23+
done
24+
25+
if [ "$BROKEN_LINKS" -eq 1 ]; then
26+
exit 1
27+
fi
28+
29+
# 3. Validate exhibits
30+
if [ -f ".githooks/validate-exhibit" ]; then
31+
.githooks/validate-exhibit || exit 1
32+
fi
33+
34+
echo "Pre-push checks passed."
35+
exit 0

0 commit comments

Comments
 (0)