bilhej/scripts/pre-commit-check.sh
Joakim Mörling c578463b10
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m6s
CI / E2E browser tests (pull_request) Failing after 1m8s
Add mandatory pre-commit full check for agents and devs.
Document that ./gradlew check must pass before every commit. Add scripts
to run the same verification as CI and optionally install a git hook.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 13:43:35 +02:00

20 lines
786 B
Bash
Executable file

#!/usr/bin/env bash
# Runs the same verification as CI before allowing a commit.
# Install: ./scripts/install-pre-commit-hook.sh
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
export POSTGRES_DB="${POSTGRES_DB:-bilhej}"
export POSTGRES_USER="${POSTGRES_USER:-bilhej}"
export POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-test_pw_ci_123}"
export JWT_SECRET="${JWT_SECRET:-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}"
export STRIPE_SECRET_KEY="${STRIPE_SECRET_KEY:-sk_test_fake}"
export STRIPE_WEBHOOK_SECRET="${STRIPE_WEBHOOK_SECRET:-whsec_fake}"
export STRIPE_PRICE_ID="${STRIPE_PRICE_ID:-price_fake}"
echo "pre-commit: running ./gradlew check (lint + unit + E2E in Docker)..."
./gradlew check --no-daemon
echo "pre-commit: all checks passed."