Created
June 25, 2019 08:09
-
-
Save watzon/2ef22d628e765c6358f2da89e7e6824c to your computer and use it in GitHub Desktop.
Deleting forks with octokit.cr
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" | |
client = Octokit.client(access_token: "***********************************0a937") | |
puts "Fetching repositories" | |
repos = client.repositories("watzon").fetch_all | |
puts "Selecting forks" | |
repos = repos.select { |r| r.fork == true } | |
repos.each do |repo| | |
puts "Delete repository #{repo.full_name}? " | |
response = gets | |
if ["y", "Y"].includes?(response) | |
puts "Deleting #{repo.full_name}" | |
client.delete_repository(repo.id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment