Automatically announce Subversion commits on Yammer with svn2yammer


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.

[github_cv url='https://github.com/jasongrimes/svn2yammer/blob/master/svn2yammer.php']

To set it up yourself, follow these steps.

Requirements

  • 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 svn@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.

6 thoughts on “Automatically announce Subversion commits on Yammer with svn2yammer”

  1. Now, there are hundreds of programs available ranging from free to hundreds of dollars, including
    everything from a bare bones setup to an all inclusive image editing
    suit. He knew the system well enough to not pay many of his suppliers and sub-contractors,
    then would cover it up up by handing out fake lien releases to make
    it look like they were paid. You wont get a
    true imitation of your signature with this Android app, unless you can cleverly manipulate the mechanics behind
    its operation, but that is highly unlikely.

  2. Howdy, I believe your web site might be having web
    browser compatibility problems. When I look at your site in
    Safari, it looks fine however, when opening in Internet Explorer, it’s got some overlapping issues.
    I merely wanted to provide you with a quick heads up!
    Besides that, fantastic blog!

Comments are closed.