-
-
Save nandub/520339a6434aa7ee5d794f8fe98b6583 to your computer and use it in GitHub Desktop.
This git hook appends "[ci skip]" to your commit message if the readme file is the only thing being touched. Read more about it here - http://about.travis-ci.org/docs/user/how-to-skip-a-build/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# a list of all files that are changing with this commit | |
FILES_CHANGING=$(git diff --cached --name-only --diff-filter=ACM) | |
# if there is only one file changing | |
if [ $(echo "$FILES_CHANGING" | wc -l) -eq 1 ]; then | |
# and that file is a readme | |
README_CHANGING=$(echo $FILES_CHANGING | grep -Ei "readme(.md|.txt)?$") | |
if [ -n $README_CHANGING ]; then | |
# append it to $1 - the file containing the commit message | |
echo " [ci skip]" >> $1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment