summaryrefslogtreecommitdiffstats
path: root/pre-commit.sh
diff options
context:
space:
mode:
authorJohn Westcott IV <32551173+john-westcott-iv@users.noreply.github.com>2022-02-07 21:42:35 +0100
committerGitHub <noreply@github.com>2022-02-07 21:42:35 +0100
commitc8b906ffb7aeeeeabb5c3e79484efc6d72858640 (patch)
treec5537bff871d96534447c43a944e390afe8e5481 /pre-commit.sh
parentMerge pull request #11685 from shanemcd/skip-pytest-7.0.0 (diff)
downloadawx-c8b906ffb7aeeeeabb5c3e79484efc6d72858640.tar.xz
awx-c8b906ffb7aeeeeabb5c3e79484efc6d72858640.zip
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
Diffstat (limited to 'pre-commit.sh')
-rwxr-xr-xpre-commit.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/pre-commit.sh b/pre-commit.sh
index 4f073799a5..80a49fb47c 100755
--- a/pre-commit.sh
+++ b/pre-commit.sh
@@ -1,6 +1,8 @@
-if [ -z $AWX_IGNORE_BLACK ]
-then
- black --check $(git diff --cached --name-only --diff-filter=AM | grep -E '\.py') || \
- (echo 'To fix this, run `make black` to auto-format your code prior to commit, or set AWX_IGNORE_BLACK=1' && \
- exit 1)
+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