Last active
December 19, 2015 10:08
-
-
Save evan/5937649 to your computer and use it in GitHub Desktop.
Enable all types of github notifications for all your github hooks.
This file contains hidden or 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 | |
require 'json' | |
require 'pp' | |
user = ENV['USER'] | |
pass = ENV['PASS'] | |
notifications = %w(commit_comment create delete download follow fork fork_apply gist gollum | |
issue_comment issues member public pull_request push team_add watch | |
pull_request_review_comment status) | |
notifications_json = {"events" => notifications}.to_json | |
# get all repos | |
repos = JSON.parse(`curl --silent -u '#{user}:#{pass}' https://api.github.com/user/repos`) | |
repos.each do |repo| | |
# get hooks | |
JSON.parse(`curl --silent -u '#{ user}:#{pass}' https://api.github.com/repos/#{user}/#{repo["name"]}/hooks`).each do |hook| | |
# enable notifications for hook | |
pp JSON.parse(`curl --silent -u '#{user}:#{pass}' -XPOST https://api.github.com/repos/#{user}/#{repo["name"]}/hooks/#{hook["id"]} -d #{notifications_json.inspect}`) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment