diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit new file mode 100755 index 00000000..c0493ed0 --- /dev/null +++ b/.github/hooks/pre-commit @@ -0,0 +1,10 @@ +#!/bin/bash + +# Check for updates to files ending with "pro.py" +if git diff --cached --name-only | grep -E 'pro.py'; then + echo "HOOK Error: You have made updates to files ending with 'pro.py' it's forbidden." + echo "Please remove or revert these changes before committing." + exit 1 +fi + +exit 0 diff --git a/run.bat b/run.bat index 7c8f40f7..02b0a3e9 100644 --- a/run.bat +++ b/run.bat @@ -8,6 +8,8 @@ if errorlevel 1 ( exit /b 1 ) +copy .\.github\hooks\pre-commit .\.git\hooks\ + echo Installing missing packages... call %PYTHON_CMD% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt diff --git a/run.sh b/run.sh index b7b17e6d..7b137fd2 100755 --- a/run.sh +++ b/run.sh @@ -66,6 +66,8 @@ function kill_by_port() { kill -9 $pid } +cp .github/hooks/pre-commit .git/hooks/ + kill_by_port $(get_config_value "FRONTEND_PORT") kill_by_port $(get_config_value "BACKEND_PORT")