Skip to content

Instantly share code, notes, and snippets.

@danvine
Created September 6, 2013 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danvine/6463638 to your computer and use it in GitHub Desktop.
Save danvine/6463638 to your computer and use it in GitHub Desktop.
Kill tenxer hooks for all repos owned by an organization.
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