1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 09:25:10 +03:00
awx/pre-commit.sh
John Westcott IV c8b906ffb7
Workflow changes (#11692)
Modifying workflows to install python for make commands
Squashing CI tasks to remove repeated steps
Modifying pre-commit.sh to not fail if there are no python file changes
2022-02-07 15:42:35 -05:00

9 lines
365 B
Bash
Executable File

if [ -z $AWX_IGNORE_BLACK ] ; then
python_files_changed=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.py')
if [ "x$python_files_changed" != "x" ] ; then
black --check $python_files_changed || \
(echo 'To fix this, run `make black` to auto-format your code prior to commit, or set AWX_IGNORE_BLACK=1' && \
exit 1)
fi
fi