Skip to content

Commit 2db19f4

Browse files
build: update prepush hook to add skip check option
1 parent fae6d11 commit 2db19f4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.husky/pre-push

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/bin/sh
22
[ -n "$CI" ] && exit 0
33

4-
echo "Running build and tests..."
5-
yarn test && yarn build
4+
# Check for skip checks via environment variable
5+
# Usage:
6+
# - Run with env var: SKIP_PUSH_HOOK=1 git push
7+
if [ "$SKIP_PUSH_HOOK" = "1" ]; then
8+
echo "Skipping build and tests..."
9+
exit 0
10+
else
11+
echo "Running build and tests..."
12+
yarn test && yarn build
613

7-
if [ $? -ne 0 ]; then
8-
echo "Build or tests failed. Please fix errors before pushing."
9-
exit 1
14+
if [ $? -ne 0 ]; then
15+
echo "Build or tests failed. Please fix errors before pushing or use 'SKIP_PUSH_HOOK=1 git push' to skip."
16+
exit 1
17+
fi
1018
fi

0 commit comments

Comments
 (0)