Skip to content

Instantly share code, notes, and snippets.

@jperras
Created February 21, 2011 15:56
Show Gist options
  • Save jperras/837253 to your computer and use it in GitHub Desktop.
Save jperras/837253 to your computer and use it in GitHub Desktop.
Pivotal Tracker SVN Post-Commit Hook
#!/bin/sh
set -e
REPO="$1"
REV="$2"
AUTHOR=`/usr/bin/svnlook author $REPO -r $REV`
MESSAGE=`/usr/bin/svnlook log $REPO -r $REV`
# You must HTML-escape the XML post data
MESSAGE=${MESSAGE//&/&}
MESSAGE=${MESSAGE//</&lt;}
MESSAGE=${MESSAGE//>/&gt;}
# This is just a simple example. You also need to handle the AUTHOR, as well as quotes, backticks, etc...
# If you have a better one, please let us know, and we'll add it to the list of Tracker 3rd Party Tools
# at http://pivotaltracker.com/help/thirdpartytools.
RESPONSE=`curl -H "X-TrackerToken: TOKEN" -X POST -H "Content-type: application/xml" \
-d "<source_commit><message>$MESSAGE</message><author>$AUTHOR</author><commit_id>$REV</commit_id></source_commit>" \
http://www.pivotaltracker.com/services/v3/source_commits`
echo $RESPONSE >> /tmp/tracker_post_commit.log
@jperras
Copy link
Author

jperras commented Feb 21, 2011

Required syntax:
[#12345678] Diverting power from warp drive to torpedoes.

This adds the above comment to the given story #. Can also use [Fixes #12345678] or [Delivers #12345678]

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