Created
July 27, 2012 02:49
-
-
Save mkaito/3185932 to your computer and use it in GitHub Desktop.
post-receive hook to notify our hubot instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Notify hubot when someone pushes. | |
require 'net/http' | |
branches = [] | |
cnum = 0 | |
STDIN.each do |line| | |
(oldref, newref, refname) = line.split | |
branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp | |
cnum += `git log --format=oneline #{oldref}..#{newref} | wc -l`.chomp | |
end | |
branches = branches.uniq.join(", ") | |
repo = ENV['GL_REPO'] | |
user = ENV['GL_USER'] | |
uri = URI('http://memorici.de:54545/hubot/git/pushed/spaceships/') | |
Net::HTTP.post_form uri, 'user' => user, 'num' => cnum, 'branch' => branches, 'repo' => repo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment