OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
chore: pre commit hook only on main
Carl-Gerhard Lindesvärdc3ad204abddb
diff --git a/package.json b/package.jsonindex 733d8aea6..536431719 100644--- a/package.json+++ b/package.json@@ -84,7 +84,7 @@"fix": "ultracite fix"},"simple-git-hooks": {- "pre-push": "[ -n \"$SKIP_HOOKS\" ] || (bun run typecheck && bun run test)"+ "pre-push": "sh tooling/scripts/pre-push.sh"},"dependencies": {"@hyperdx/node-opentelemetry": "catalog:",diff --git a/tooling/scripts/pre-push.sh b/tooling/scripts/pre-push.shnew file mode 100755index 000000000..b2b403549--- /dev/null+++ b/tooling/scripts/pre-push.sh@@ -0,0 +1,15 @@+#!/bin/sh+# Every push to main is a release, so it has to pass typecheck and tests+# locally. Feature branches get the same checks from CI on their PR.+# git passes "<local ref> <local sha> <remote ref> <remote sha>" per ref on stdin.++[ -n "$SKIP_HOOKS" ] && exit 0++pushes_main=false+while read -r _local_ref _local_sha remote_ref _remote_sha; do+ [ "$remote_ref" = "refs/heads/main" ] && pushes_main=true+done++[ "$pushes_main" = true ] || exit 0++bun run typecheck && bun run test