Skip to content

Instantly share code, notes, and snippets.

@ShaunPlummer
Created August 6, 2019 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShaunPlummer/17f620880c0249758bc0f5f40b8cac19 to your computer and use it in GitHub Desktop.
Save ShaunPlummer/17f620880c0249758bc0f5f40b8cac19 to your computer and use it in GitHub Desktop.
Example of a pre commit hook which runs a series of gradle tasks.
#!/bin/sh
#declare -a arr=("./gradlew ktlint" "./gradlew detekt")
declare -a arr=()
for i in "${arr[@]}"
do
$i
RESULT=$?
echo output: $RESULT
if [ $RESULT != "0" ]
then
echo Pre commit hook failure
exit $RESULT
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment