aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-08-30 18:07:15 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-08-30 18:07:15 -0700
commitc100b8548fd7262a1275bdb867186d0cd94e8b45 (patch)
treeea317607d411702abd24cb6829cbba9f158d3174 /.github
parentca56b02c8cce467713021b038d536918579633b1 (diff)
tools: pre-push hook only runs on master
Diffstat (limited to '.github')
-rwxr-xr-x.github/pre-push11
1 files changed, 9 insertions, 2 deletions
diff --git a/.github/pre-push b/.github/pre-push
index b837eec..ecb23a9 100755
--- a/.github/pre-push
+++ b/.github/pre-push
@@ -1,4 +1,11 @@
#!/bin/bash
set -e
-make lint
-make test
+IFS=' '
+while read local_ref _local_sha _remote_ref _remote_sha; do
+ remote_main=$( (git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo "///master") | cut -f 4 -d / | tr -d "[:space:]")
+ local_ref_short=$(echo "$local_ref" | cut -f 3 -d / | tr -d "[:space:]")
+ if [ "$local_ref_short" = "$remote_main" ]; then
+ make lint
+ make test
+ fi
+done