Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env ruby
require 'pit'
require 'octokit'
slug = ARGV[0]
unless slug
abort "Usage #{$0} slug"
end
config = Pit.get('github', :require => {
'username' => 'Your user name of GitHub',
'password' => 'Your password of GitHub',
})
octokit = Octokit::Client.new(
login: config['username'],
password: config['password']
)
# https://github.com/github/github-services/blob/master/lib/services/hipchat.rb#L6-L8
events = %w(
commit_comment
download
fork
fork_apply
gollum
issues
issue_comment
member
public
pull_request
pull_request_review_comment
push
watch
)
octokit.hooks(slug).each do |hook|
if hook.name == 'irc'
puts "before: #{hook[:events].join(',')}"
octokit.edit_hook(slug, hook.id, hook.name, hook.config.attrs, 'events' => events)
puts "updated: #{slug}"
puts "after: #{hook[:events].join(',')}"
end
end
@banyan

This comment has been minimized.

Copy link
Owner Author

banyan commented Nov 7, 2013

Usage:

☁  ruby update-irc-hooks-event.rb 'banyan/test-repo'
@banyan

This comment has been minimized.

Copy link
Owner Author

banyan commented Nov 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.