Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a script to change multiple irc hooks password

  • Loading branch information...
commit 17226c9791d8ad775a8ea9727e21eec405eaa3f6 1 parent 46ff16b
@mizzy authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 change-irc-hooks-password.rb
View
32 change-irc-hooks-password.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+
+require 'pit'
+require 'octokit'
+
+password = ARGV[0]
+
+if ! password
+ puts "Usage #{$0} password"
+ exit
+end
+
+config = Pit.get('github', :require => {
+ 'username' => 'Your user name of GitHub Enterprise',
+ 'password' => 'Your password of GitHub Enterprise',
+ })
+octokit = Octokit::Client.new(:login => config['username'], :password => config['password'])
+
+octokit.orgs.each do |org|
+ org = org.login
+ next unless org.match(/^paperboy-.*/)
+ octokit.org_repos(org).each do |repo|
+ repo = repo.full_name
+ octokit.hooks(repo).each do |hook|
+ if hook.name == 'irc' and hook.config.server == 'irc.paperboy.co.jp'
+ puts "Changing IRC hook password of #{repo} ..."
+ hook.config.password = password
+ octokit.edit_hook(repo, hook.id, hook.name, hook.config)
+ end
+ end
+ end
+end

0 comments on commit 17226c9

Please sign in to comment.
Something went wrong with that request. Please try again.