Skip to content

Commit b18b67c

Browse files
committed
chore(hook): add pre commit hook
1 parent 81736df commit b18b67c

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.github/hooks/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Check for updates to files ending with "pro.py"
4+
if git diff --cached --name-only | grep -E 'pro.py'; then
5+
echo "HOOK Error: You have made updates to files ending with 'pro.py' it's forbidden."
6+
echo "Please remove or revert these changes before committing."
7+
exit 1
8+
fi
9+
10+
exit 0

run.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ if errorlevel 1 (
88
exit /b 1
99
)
1010

11+
copy .\.github\hooks\pre-commit .\.git\hooks\
12+
1113
echo Installing missing packages...
1214
call %PYTHON_CMD% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
1315

run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ function kill_by_port() {
6666
kill -9 $pid
6767
}
6868

69+
cp .github/hooks/pre-commit .git/hooks/
70+
6971
kill_by_port $(get_config_value "FRONTEND_PORT")
7072
kill_by_port $(get_config_value "BACKEND_PORT")
7173

0 commit comments

Comments
 (0)