Created
December 8, 2010 23:52
-
-
Save lsolesen/734137 to your computer and use it in GitHub Desktop.
build-failed git hook for cijoe
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 | |
# Note the use of env. This is because executables may not be placed in the same place on all systems. Notoriously, bsd (and thus mac osx) differs from linux. However, /usr/bin/env always exists in the same place, and it can tell you where other executables are. Thus, the above is good style for portability. | |
COMMIT_VERSION=$(git rev-parse --verify HEAD) | |
COMMIT_LOG=$(git log -n 1) | |
# You could also use backticks, but the $() syntax is generally more readable | |
# Convention is to put variables in uppercase in shell script | |
LOG="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${COMMIT_LOG}")" | |
curl -k -u user:password \ | |
-d "to=lsolesen&msg=${LOG}&title=Intraface+build+failed&uri=https%3A%2F%2Fgithub.com%2Fintraface%2Fintraface.dk%2Fcommit%2F${COMMIT_VERSION}" \ | |
https://api.notifo.com/v1/send_notification > /dev/null | |
# You can embed a variable in a string, using the ${VAR_NAME} syntax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment