mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 02:17:37 -02:30
Adding ability to run user level pre-commit hooks (#11923)
* Adding ability to run user level pre-commit hooks * Adding pre-commit docs in CONTRIBUTING.md
This commit is contained in:
@@ -6,3 +6,22 @@ if [ -z $AWX_IGNORE_BLACK ] ; then
|
||||
exit 1)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $AWX_IGNORE_USER ] ; then
|
||||
FAIL=0
|
||||
export CHANGED_FILES=$(git diff --cached --name-only --diff-filter=AM)
|
||||
if [ -d ./pre-commit-user ] ; then
|
||||
for SCRIPT in `find ./pre-commit-user -executable -type f` ; do
|
||||
echo "Running user pre-commit hook $SCRIPT"
|
||||
$SCRIPT
|
||||
if [ $? != 0 ] ; then
|
||||
echo "User test $SCRIPT failed"
|
||||
FAIL=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ $FAIL == 1 ] ; then
|
||||
echo "One or more user tests failed, see messages above"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user