The staff at ProZ.com use the private social networking tool Yammer to post internal status updates. It’s an easy way to stay in the loop and know what everyone else in the company is up to.
I wrote a PHP script that posts to our Developers group on Yammer every time someone commits to our Subversion repository, to help keep on top of changes in the codebase.
The Yammer message includes the developer’s commit message and the list of changed files, with a link to view the changeset in WebSVN. If a developer wants to comment on the change, he can just reply to the Yammer message.
Here’s an example of a Subversion commit shown in Yammer:
Yammer has an API to support things like this, but it’s not easy to use. See The Many Ways in Which the Yammer API Sucks (pointbeing.net) for a lengthy discussion.
Fortunately, there’s an easier way. Yammer provides an email gateway for posting messages via email. The svn2yammer post-commit script takes advantage of this feature.
To set it up yourself, follow these steps.
- Yammer and Subversion (of course).
- PHP on the Subversion server.
- Ability to create email aliases at your domain (optional).
Step 1: Create an email alias and Yammer account for Subversion (optional). Set up an email alias like email@example.com. You’ll need to be able to receive email sent to this address. Add it as a Yammer account, and confirm the email address in Yammer. Alternately, Subversion could post to Yammer from your own email address.
Step 2: Turn off confirmation of posts via email. By default, posts via email need to be confirmed. You’ll want to turn this off for the Subversion account. Send a test message to Yammer from the account that will post Subversion commits. Yammer will reply with a “Confirm your post” message. At the bottom of this message, click “To change your notifications settings, go here.” Untick the “confirm” option.
Step 3: Install the commit script. Download svn2yammer from GitHub (or copy/paste it from above). Save it somewhere on your Subversion server. Edit the config options at the top of the script. See the Yammer email gateway instructions to figure out what the “to” address needs to be.
Step 4: Set up the Subversion post-commit hook. Edit the “hooks/post-commit” file in the repository directory on your Subversion server, and add the following (adjusting the paths as necessary):
REPOS="$1" REV="$2" /usr/bin/php /path/to/svn2yammer.php $REPOS $REV
That’s it. Now commit something and see if it works.