Skip to content

Instantly share code, notes, and snippets.

@fancyremarker
Created December 3, 2014 15:24
Show Gist options
  • Save fancyremarker/e033b1ff37b10cb859c4 to your computer and use it in GitHub Desktop.
Save fancyremarker/e033b1ff37b10cb859c4 to your computer and use it in GitHub Desktop.
Script to clean up HuBoard labels (e.g., for moving to Waffle)
#!/usr/bin/env ruby
# Usage: ruby huboard-cleanup.rb ORG_HANDLE
require 'octokit'
org_login = ARGV[0]
events = ARGV[1..-1]
print 'Username: '
username = $stdin.gets.chomp
print 'Password: '
password = $stdin.gets.chomp
Octokit.configure do |c|
c.login = username
c.password = password
end
Octokit.auto_paginate = true
Octokit.org_repos(org_login).each do |repo|
labels = Octokit.labels(repo.full_name).map(&:name)
labels.each do |label|
next unless label =~ /^Link <=>/ ||
label =~ /^[0-9] - / ||
label == 'private-beta' ||
label == 'in progress' ||
label == 'active'
puts "Deleting #{label} from #{repo.full_name}..."
Octokit.delete_label!(repo.full_name, label)
end
end
# $ ruby huboard-cleanup.rb aptible
# Deleting 0 - Backlog from aptible/aptible.github.io...
# Deleting 1 - Ready from aptible/aptible.github.io...
# Deleting 2 - Working from aptible/aptible.github.io...
# Deleting 3 - Done from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-nginx from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-couchdb from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-postgresql from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-redis from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-mongodb from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-mysql from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-elasticsearch from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-ruby from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-nodejs from aptible/aptible.github.io...
# Deleting Link <=> aptible/docker-memcached from aptible/aptible.github.io...
# Deleting private-beta from aptible/megatron...
# Deleting 0 - Backlog from aptible/megatron...
# Deleting 1 - Ready from aptible/megatron...
# Deleting 2 - Working from aptible/megatron...
# Deleting 3 - Done from aptible/megatron...
# Deleting 0 - Backlog from aptible/auth.aptible.com...
# Deleting 1 - Ready from aptible/auth.aptible.com...
# Deleting 2 - Working from aptible/auth.aptible.com...
# Deleting 3 - Done from aptible/auth.aptible.com...
# Deleting private-beta from aptible/api.aptible.com...
# Deleting active from aptible/api.aptible.com...
# Deleting 0 - Backlog from aptible/api.aptible.com...
# Deleting 1 - Ready from aptible/api.aptible.com...
# Deleting 2 - Working from aptible/api.aptible.com...
# Deleting 3 - Done from aptible/api.aptible.com...
# Deleting Link <=> aptible/auth.aptible.com from aptible/api.aptible.com...
# Deleting Link <=> aptible/gridiron from aptible/api.aptible.com...
# Deleting private-beta from aptible/aptible-auth-ruby...
# Deleting private-beta from aptible/aptible-api-ruby...
# Deleting 0 - Backlog from aptible/primetime...
# Deleting 1 - Ready from aptible/primetime...
# Deleting 2 - Working from aptible/primetime...
# Deleting 3 - Done from aptible/primetime...
# Deleting active from aptible/aptible-cli...
# Deleting 0 - Backlog from aptible/aptible-cli...
# Deleting 1 - Ready from aptible/aptible-cli...
# Deleting 2 - Working from aptible/aptible-cli...
# Deleting 3 - Done from aptible/aptible-cli...
# Deleting 0 - Backlog from aptible/gridiron...
# Deleting 1 - Ready from aptible/gridiron...
# Deleting 2 - Working from aptible/gridiron...
# Deleting 3 - Done from aptible/gridiron...
# Deleting private-beta from aptible/aptible-cookbook...
# Deleting 0 - Backlog from aptible/aptible-cookbook...
# Deleting 1 - Ready from aptible/aptible-cookbook...
# Deleting 2 - Working from aptible/aptible-cookbook...
# Deleting 3 - Done from aptible/aptible-cookbook...
# Deleting 0 - Backlog from aptible/dashboard.aptible.com...
# Deleting 1 - Ready from aptible/dashboard.aptible.com...
# Deleting 2 - Working from aptible/dashboard.aptible.com...
# Deleting 3 - Done from aptible/dashboard.aptible.com...
# Deleting Link <=> aptible/risk.aptible.com from aptible/dashboard.aptible.com...
# Deleting Link <=> aptible/security.aptible.com from aptible/dashboard.aptible.com...
# Deleting Link <=> aptible/policy.aptible.com from aptible/dashboard.aptible.com...
# Deleting Link <=> aptible/www.aptible.com from aptible/dashboard.aptible.com...
# Deleting Link <=> aptible/aptible-cli from aptible/dashboard.aptible.com...
# Deleting 0 - Backlog from aptible/aptible-risk...
# Deleting 1 - Ready from aptible/aptible-risk...
# Deleting 2 - Working from aptible/aptible-risk...
# Deleting 3 - Done from aptible/aptible-risk...
# Deleting 0 - Backlog from aptible/docker-ruby...
# Deleting 1 - Ready from aptible/docker-ruby...
# Deleting 2 - Working from aptible/docker-ruby...
# Deleting 3 - Done from aptible/docker-ruby...
# Deleting 0 - Backlog from aptible/aptible-policy...
# Deleting 1 - Ready from aptible/aptible-policy...
# Deleting 2 - Working from aptible/aptible-policy...
# Deleting 3 - Done from aptible/aptible-policy...
# Deleting 0 - Backlog from aptible/sweetness-cookbook...
# Deleting 1 - Ready from aptible/sweetness-cookbook...
# Deleting 2 - Working from aptible/sweetness-cookbook...
# Deleting 3 - Done from aptible/sweetness-cookbook...
# Deleting 0 - Backlog from aptible/docker-postgresql...
# Deleting 1 - Ready from aptible/docker-postgresql...
# Deleting 2 - Working from aptible/docker-postgresql...
# Deleting 3 - Done from aptible/docker-postgresql...
# Deleting 0 - Backlog from aptible/docker-nginx...
# Deleting 1 - Ready from aptible/docker-nginx...
# Deleting 2 - Working from aptible/docker-nginx...
# Deleting 3 - Done from aptible/docker-nginx...
# Deleting 0 - Backlog from aptible/docker-redis...
# Deleting 1 - Ready from aptible/docker-redis...
# Deleting 2 - Working from aptible/docker-redis...
# Deleting 3 - Done from aptible/docker-redis...
# Deleting 0 - Backlog from aptible/docker-nodejs...
# Deleting 1 - Ready from aptible/docker-nodejs...
# Deleting 2 - Working from aptible/docker-nodejs...
# Deleting 3 - Done from aptible/docker-nodejs...
# Deleting 0 - Backlog from aptible/aptible-security...
# Deleting 1 - Ready from aptible/aptible-security...
# Deleting 2 - Working from aptible/aptible-security...
# Deleting 3 - Done from aptible/aptible-security...
# Deleting 0 - Backlog from aptible/docker-mongodb...
# Deleting 1 - Ready from aptible/docker-mongodb...
# Deleting 2 - Working from aptible/docker-mongodb...
# Deleting 3 - Done from aptible/docker-mongodb...
# Deleting 0 - Backlog from aptible/broadwayjoe...
# Deleting 1 - Ready from aptible/broadwayjoe...
# Deleting 2 - Working from aptible/broadwayjoe...
# Deleting 3 - Done from aptible/broadwayjoe...
# Deleting 0 - Backlog from aptible/opsworks-cli...
# Deleting 1 - Ready from aptible/opsworks-cli...
# Deleting 2 - Working from aptible/opsworks-cli...
# Deleting 3 - Done from aptible/opsworks-cli...
# Deleting 0 - Backlog from aptible/www.aptible.com...
# Deleting 1 - Ready from aptible/www.aptible.com...
# Deleting 2 - Working from aptible/www.aptible.com...
# Deleting 3 - Done from aptible/www.aptible.com...
# Deleting 0 - Backlog from aptible/docker-memcached...
# Deleting 1 - Ready from aptible/docker-memcached...
# Deleting 2 - Working from aptible/docker-memcached...
# Deleting 3 - Done from aptible/docker-memcached...
# Deleting 0 - Backlog from aptible/docker-mysql...
# Deleting 1 - Ready from aptible/docker-mysql...
# Deleting 2 - Working from aptible/docker-mysql...
# Deleting 3 - Done from aptible/docker-mysql...
# Deleting 0 - Backlog from aptible/docker-couchdb...
# Deleting 1 - Ready from aptible/docker-couchdb...
# Deleting 2 - Working from aptible/docker-couchdb...
# Deleting 3 - Done from aptible/docker-couchdb...
# Deleting 0 - Backlog from aptible/docker-elasticsearch...
# Deleting 1 - Ready from aptible/docker-elasticsearch...
# Deleting 2 - Working from aptible/docker-elasticsearch...
# Deleting 3 - Done from aptible/docker-elasticsearch...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment