Skip to content

Instantly share code, notes, and snippets.

@watzon
Created June 25, 2019 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watzon/2ef22d628e765c6358f2da89e7e6824c to your computer and use it in GitHub Desktop.
Save watzon/2ef22d628e765c6358f2da89e7e6824c to your computer and use it in GitHub Desktop.
Deleting forks with octokit.cr
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