Skip to content

Commit ffbda62

Browse files
committed
Introduce pre-commit, let's get people to hate us :)
1 parent 1c988d5 commit ffbda62

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

scripts/git-hooks/pre-push

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
#ddev-generated
3+
4+
# ── Sanity check ─────────────────────────────────────────────────────────────
5+
ddev sanity-check
6+
if [[ $? -ne 0 ]]; then
7+
echo ""
8+
echo "🚫 Push aborted: sanity-check failed. Fix the issues above or use --no-verify to push anyway."
9+
exit 1
10+
fi
11+
12+
# ── Backstop tests check ────────────────────────────────────────────────────
13+
if [ -f "tests/backstop/backstop.json" ]; then
14+
BASE_DIR="tests/backstop/backstop_data/bitmaps_test"
15+
TODAY=$(date +%Y%m%d)
16+
MATCH=$(find "$BASE_DIR" -maxdepth 1 -type d -name "${TODAY}-*" 2>/dev/null)
17+
18+
if [ -z "$MATCH" ]; then
19+
echo ""
20+
echo "=================================================================================================="
21+
echo "⚠️ No Backstop test folder found for today ($TODAY) in $BASE_DIR"
22+
echo "Did you run Backstop and other tests?"
23+
echo "=================================================================================================="
24+
echo ""
25+
read -p "Continue pushing without Backstop tests? (y/N): " backstop_confirm </dev/tty
26+
backstop_confirm=${backstop_confirm:-N}
27+
if [[ ! "$backstop_confirm" =~ ^[Yy] ]]; then
28+
echo "🚫 Push aborted. Run Backstop and other tests or use --no-verify to skip this check."
29+
exit 1
30+
fi
31+
fi
32+
fi
33+
34+
exit 0

0 commit comments

Comments
 (0)