From 98d5ec92ed0b4d42fe82b43f71f99bf31f28cc91 Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Fri, 27 Mar 2026 08:28:16 +1000 Subject: [PATCH] fix: add pre commit hook --- .githooks/pre-commit | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 000000000..61221d6a3 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +branch=$(git rev-parse --abbrev-ref HEAD) + +# Only enforce preflight on dev and main +if [ "$branch" != "dev" ] && [ "$branch" != "main" ]; then + exit 0 +fi + +# Only run preflight if Go files were staged +if git diff --cached --name-only | grep -q '\.go$'; then + echo "Go files staged on $branch — running make preflight..." + make preflight +else + echo "No Go files staged, skipping preflight." +fi