Skip to content

Commit

Permalink
chore(hook): add pre commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
booboosui committed Aug 17, 2023
1 parent 81736df commit b18b67c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit b18b67c

Please sign in to comment.