Created
August 23, 2011 00:54
-
-
Save ceronman/1164034 to your computer and use it in GitHub Desktop.
Publish-bot git commit hook
This file contains hidden or 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
| #!/bin/bash | |
| HOST= | |
| PORT= | |
| PUBLISH_PASSWORD= | |
| IRC_CHANNEL= | |
| IRC_CHANNEL_PASSWORD= | |
| CURRENT_BRANCH=$(git branch --no-color 2>/dev/null | grep '^*' | cut -d' ' -f2) | |
| COMMIT_MESSAGE=$(git log -n 1 --pretty=short) | |
| IRC_MESSAGE="New commit to [$CURRENT_BRANCH]:\n$COMMIT_MESSAGE" | |
| prefix=$PUBLISH_PASSWORD:$IRC_CHANNEL/$IRC_CHANNEL_PASSWORD: | |
| sufix="\r\n" | |
| echo -e "$IRC_MESSAGE" | while read line | |
| do | |
| echo -ne ${prefix}${line}${sufix} | |
| done | nc $HOST $PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment