-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-push.sh
More file actions
29 lines (23 loc) · 729 Bytes
/
pre-push.sh
File metadata and controls
29 lines (23 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# .git/hooks/pre-push
# This script runs wcheck scan before every git push.
# If wcheck fails (exit code 1), the push will be canceled.
TARGET_URL="http://localhost:3000"
WORKERS=5
echo "--------------------------------------------------------"
echo " [wcheck] Scouting $TARGET_URL before push..."
echo "--------------------------------------------------------"
# Run wcheck
wcheck scan "$TARGET_URL" -w "$WORKERS"
# Store the exit code
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo ""
echo " [!] ERROR: wcheck found errors on $TARGET_URL."
echo " [!] Push aborted. Please fix errors before pushing."
exit 1
else
echo ""
echo " [OK] wcheck scouted successfully. Proceeding with push..."
exit 0
fi