diff --git a/.githooks/install.sh b/.githooks/install.sh new file mode 100644 index 0000000..e1dbf33 --- /dev/null +++ b/.githooks/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail +git config core.hooksPath .githooks +chmod +x .githooks/pre-push 2>/dev/null || true +echo "Git hooks installed (core.hooksPath=.githooks)." +echo "pre-push: shellcheck scripts/*.sh + bats tests/ (skipped if tools missing)" diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100644 index 0000000..e4dd979 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +if command -v shellcheck >/dev/null 2>&1; then + echo "==> shellcheck scripts/*.sh" + shellcheck scripts/*.sh +else + echo "(shellcheck not installed — skipping; CI will run it)" +fi + +if command -v bats >/dev/null 2>&1; then + echo "==> bats tests/" + bats tests/ +else + echo "(bats not installed — skipping; CI will run it)" +fi