Created
May 17, 2020 12:28
-
-
Save arfon/8c8990d5fb9501b302502ac5e2072b66 to your computer and use it in GitHub Desktop.
GitHub repo cleanup
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 'octokit' | |
GH_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxx" | |
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