add commit bot
This commit is contained in:
parent
671915db12
commit
64ae157c7b
30
scripts/post-update-notify.rb
Normal file
30
scripts/post-update-notify.rb
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'xmpp4r'
|
||||
require 'xmpp4r/muc/helper/simplemucclient'
|
||||
|
||||
#refname = ARGV[0]
|
||||
oldrev = ARGV[1]
|
||||
newrev = ARGV[2]
|
||||
user = ENV['GL_USER']
|
||||
|
||||
@jabber_id= "git@higgsboson.tk"
|
||||
@password = "ZTA2NTlkMmNlYjNlZ"
|
||||
|
||||
robot = Jabber::Client::new(Jabber::JID::new(@jabber_id))
|
||||
robot.connect
|
||||
robot.auth(@password)
|
||||
robot.send(Jabber::Presence.new.set_type(:available))
|
||||
|
||||
muc = Jabber::MUC::SimpleMUCClient.new(robot)
|
||||
muc.join(Jabber::JID.new('lctp@muc.higgsboson.tk/git'))
|
||||
|
||||
revs = `git rev-list #{oldrev}..#{newrev}`.split("\n")
|
||||
message = "#{user} has committed: "
|
||||
revs.each do |rev|
|
||||
commit = `git cat-file commit #{rev} | sed '1,/^$/d'`
|
||||
message += "#{commit}\n"
|
||||
end
|
||||
|
||||
sleep(2)
|
||||
muc.say(message)
|
Loading…
Reference in New Issue
Block a user