Deprecation notice

Deprecation Notice: This blog is no longer updated. Please visit my current blog at subfocal.net.

Saturday, August 6, 2011

supybot-git: An IRCbot plugin for Git notifications

I was looking for a way to get git commit notifications in IRC, and there are several examples of bots that do this. However, being a Pythonista, if I'm going to run an IRC bot it's going to be one written in Python. The main idea is that I figured I'd probably want to extend it, and in that case, it ought to be in a language I love.

After some investigation, I found Supybot, a robust, extensible IRC bot written in — you guessed it — Python. It has a pretty slick installation wizard to get you up and running without fiddling with any configuration files. It also ships with a robust collection of plugins, and many have written third-party plugins as well.

Since no git notification plugin existed, I went ahead and wrote one. It's been running on my IRC server for over a year now, and I recently decided to clean it up and open source it. I present supybot-git!

It's pretty straightforward to get up and running, and has the following features:

  • Can monitor any number of repositories
  • Repositories are associated with a single IRC channel
    • repolist command lists repositories associated with the current channel
    • Notifications will appear on this channel
    • Users can display recent commit log on this channel (with shortlog command)
    • People on other channels will have no indication the repository exists
  • Asynchronous commit notification
  • Configurable polling frequency (default: every 2 minutes)
  • Configurable notification format (you can use the commit author, branch, message, provide a link to the commit, and more)
  • Reload configuration with gitrehash command

It's built with the assumption that you may want to retain some privacy, i.e. monitor a closed-source git repository. This means that people in one channel are allowed to see commit information, but other channels will have no idea that the repository even exists. I currently have my bot monitoring six repositories across three IRC channels and it has been perfectly stable.

Grab supybot-git and try it out! Let me know how it's working for you.

5 comments:

  1. Nice. Personally most of my stuff is integrated via CIA, but for some private stuff this could be really useful.

    Have you considered adding a snarfer for git sha1 hashes and looking them up in the repository to show you the commit summary and maybe a link to the gitweb/cgit interface to view the full commit? That would be handy.

    ReplyDelete
  2. Thanks Colin, snarfing is a great idea. I'll have to look into that.

    ReplyDelete
  3. Hello Mike, thanks for plugin, I'll use it in few days.

    I have a question:
    - I use a team foundation server / git repo bidirectional bridge. That way, my git repo is refreshed from TFS. This git repo now be sync with a GitHub repo. And in GitHub website, there's some more features, like Bugs, Wiki, etc... Is it possible to send that kind of webhooks to the bot and displays more events ?

    ReplyDelete
    Replies
    1. tfs <-> git Bidirectional link can be found here : http://git-tfs.com/

      Delete