Skip to content

Instantly share code, notes, and snippets.

@brentfisher
Created January 17, 2014 23:41
Show Gist options
  • Save brentfisher/8483758 to your computer and use it in GitHub Desktop.
Save brentfisher/8483758 to your computer and use it in GitHub Desktop.
Post-Commit Git Trigger - Post to HipChat
#!/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 />
&#09; - $(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]&notify=1&message_format=html&room_id=[room id]&from=GitHub&message=$encoded"
curl -d ${params} http://api.hipchat.com/v1/rooms/message/
@rra3
Copy link

rra3 commented Feb 15, 2014

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment