Created
September 6, 2013 13:14
-
-
Save danvine/6463638 to your computer and use it in GitHub Desktop.
Kill tenxer hooks for all repos owned by an organization.
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
require 'rubygems' | |
require 'bundler/setup' | |
require 'json' | |
require 'octokit' | |
# ENV['GITHUB_ORGANIZATION'] ||= "" | |
# ENV['GITHUB_USERNAME'] ||= "" | |
# ENV['GITHUB_PASSWORD'] ||= "" # https://github.com/settings/tokens/new | |
Octokit.configure do |c| | |
c.login = ENV['GITHUB_USERNAME'] | |
c.password = ENV['GITHUB_PASSWORD'] | |
end | |
@all_repos = [] | |
Octokit.org_teams(ENV['GITHUB_ORGANIZATION']).each do |team| | |
Octokit.team_repositories(team.id).each do |repo| | |
next if @all_repos.include? repo.full_name | |
@all_repos << repo.full_name | |
Octokit.hooks(repo.full_name).each do |hook| | |
if hook.name == "tenxer" | |
puts "Tenxer hook (#{hook.name} #{hook.id}) removed from: #{repo.full_name}" if Octokit.remove_hook(repo.full_name, hook.id) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment