Created
January 17, 2014 23:41
-
-
Save brentfisher/8483758 to your computer and use it in GitHub Desktop.
Post-Commit Git Trigger - Post to HipChat
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/sh | |
#coded in VIM | |
echo 'posting to hipchat' | |
repo=$(basename $(echo $PWD|cut -d/ -f1,2,3,4)) | |
var=$(cat<<EOF | |
<strong>$(git config --list | grep user.name | cut -d\= -f 2)</strong> | |
<span>pushed the following changes to: | |
$(echo ${repo}) | |
</span> | |
<br /> | |
	 - $(git log -1 | tail -n1) | |
<a href='http://ghqgit01.cb.careerbuilder.com/rarnold/consumer-profiles/commit/$(git log -1 | head -1 | cut -d ' ' -f 2)'>(link)</a> | |
) | |
encoded=$(echo ${var} | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g') | |
params="auth_token=[auth token]¬ify=1&message_format=html&room_id=[room id]&from=GitHub&message=$encoded" | |
curl -d ${params} http://api.hipchat.com/v1/rooms/message/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice!