Last active
May 13, 2017 14:57
-
-
Save searls/8449175 to your computer and use it in GitHub Desktop.
Use Octokit to add a particular webhook to all of your repos (handy for things like chat integration)
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
# This is just a scratchpad after I hacked what I needed in an irb session | |
require 'octokit' | |
Octokit.configure do |c| | |
c.login = 'searls' | |
c.password = 'c0d3b4ssssss!' | |
end | |
client = Octokit::Client.new | |
repos = client.repos #Note, for an org's repos, see `client.orgs.first.rels[:repos].get.data` | |
repos.each do |repo| | |
if repo.permissions.admin | |
client.create_hook(repo.full_name, 'web', | |
{ | |
:url => 'https://some/hook/url', | |
:content_type => 'json' | |
}, | |
{ :active => true } | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment