diff options
author | Ben Sima <ben@bsima.me> | 2023-08-21 21:35:01 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-21 21:57:08 -0400 |
commit | 3ac752fcd94cf8796c6cbe03438211d55dc2d446 (patch) | |
tree | 3e15314a9f18ff9f5258460f1796b4e3c13d5518 /Biz/Ide | |
parent | e5a6175e044d69b8f598a2c2acb9bcfd77b9001c (diff) |
Only run pre-push if there hasn't been a successful run
Diffstat (limited to 'Biz/Ide')
-rwxr-xr-x | Biz/Ide/hooks/pre-push | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/Biz/Ide/hooks/pre-push b/Biz/Ide/hooks/pre-push index 11c6bdc..85f047f 100755 --- a/Biz/Ide/hooks/pre-push +++ b/Biz/Ide/hooks/pre-push @@ -11,31 +11,42 @@ user=$(git config --get user.name) mail=$(git config --get user.email) ## - if lint "${BIZ_ROOT:?}"/**/* - then - lint_result="good" - else - lint_result="fail" - fi -## - read -r -d '' note <<EOF + while read local_ref local_sha remote_ref remote_sha + do + commit=$(git notes --ref=ci show $local_ref || true) + if [[ -n "$commit" ]] + then + lint_ok=$(grep "Lint-is: good" <<< $commit) + test_ok=$(grep "Test-is: good" <<< $commit) + if [[ $lint_ok -eq 0 || $test_ok -eq 0 ]] + then + exit 0 + fi + fi + ## + if lint "${BIZ_ROOT:?}"/**/* + then + lint_result="good" + else + lint_result="fail" + exit 1 + fi + ## + if bild --test "${BIZ_ROOT:?}"/**/* + then + test_result="good" + else + test_result="fail" + exit 1 + fi + ## + read -r -d '' note <<EOF Lint-is: $lint_result -Lint-by: $user <$mail> -Lint-at: $at -EOF - git notes --ref=ci append -m "$note" -## - if bild --test "${BIZ_ROOT:?}"/**/* - then - test_result="good" - else - test_result="fail" - fi -## - read -r -d '' note <<EOF Test-is: $test_result Test-by: $user <$mail> Test-at: $at EOF - git notes --ref=ci append -m "$note" + ## + git notes --ref=ci append -m "$note" + done ## |