Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GitHub repo cleanup
require 'octokit'
GH_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
GITHUB = Octokit::Client.new(:auto_paginate => true, :access_token => GH_TOKEN)
repositories = GITHUB.repositories('arfon')
puts "Working with #{repositories.size} repositories"
repositories.each do |r|
next unless r.fork?
print "What shall I do with #{r.full_name} (K for keep or D for delete):"
action = gets
if action.strip == "D"
puts "Deleting #{r.full_name}"
GITHUB.delete_repository(r.full_name)
elsif action.strip == "K"
puts "Keeping #{r.full_name}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment