No commit activity in last 3 years
No release in over 3 years
A Lita handler that will display GitHub commit messages in the channel
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 3.0.0.beta2

Runtime

< 5.0, >= 2.3
 Project Readme

lita-github-commits

Build Status Code Climate Coverage Status

lita-github-commits is a handler for Lita that listens for github commits and posts them in the channel. You can also ask lita for information about a commit it remembers.

Installation

Add lita-github-commits to your Lita instance's Gemfile:

gem "lita-github-commits"

Configuration

Required attributes

  • repos (Hash) - A map of repositories to allow notifications for and the chat rooms to post them in. The keys should be strings in the format "github_username/repository_name" and the values should be either a string room name or an array of string room names. If you do not wish to have notifications for a particular repository, set it's room array to "". Default: {}.

  • remember_commits_for (Integer) - Number of days lita will remember information about commits it as heard about. Setting it to 0 effectively disables the "commit/SHA" command handling. Default: 0 (no memory)

  • github_webhook_secret (String) - Optional secret that github uses to sign the webhook requests with. Currently the configuration's presence only requires that the requests from GitHub be signed. Default: nil (no signature required)

Example Config

Lita.configure do |config|
  config.handlers.github_commits.repos = {
    "username/repo1" => "#someroom",
    "username/repo2" => ["#someroom", "#someotherroom"],
    "username/muted_repo3" => ""
  }
  config.handlers.github_commits.remember_commits_for = 7
  config.handlers.github_commits.github_webhook_secret = "secr3tC0de"
end

Note: For HipChat, the room should be the JID of the HipChat room (eg. 123_development@conf.hipchat.com)

The output from Lita would look something like:

[GitHub] Got 3 new commits from Garen Torikian on octokitty/testing on the master branch
  * 32e3221: Test
  * adc2112: This is me testing the windows client.
  * 441ab6c: Rename madame-bovary.txt to words/madame-bovary.txt

Usage

You will need to add a GitHub Webhook url that points to: http://address.of.lita:8080/github-commits

In any room that Lita is listening, it will look for statements of the following form and provide the details of the commit if it remembers them. If it doesn't remember the commit (or has heard about it), it will remain silent unless its a direct command.

... commit/<SHA1>...       - Search for a commit and return the details if found

Note that it only searches the commits that it has heard about and remembers so that the bot needs no more access to the repo than a webhook.

License

MIT