Skip to content
This repository was archived by the owner on Mar 3, 2022. It is now read-only.

Commit bee0f7a

Browse files
A helper script for cleaning up(deleting all repos)
1 parent f60b583 commit bee0f7a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/delete_all_repos.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require "helper"
2+
require "json"
3+
require "pp"
4+
5+
# This is helpful if your account(fake) gets littered with repos.
6+
# You need to run ruby -I. delete_all_repos.rb. If you are executing from a
7+
# different directory then you need to change the parameter of -I
8+
# appropriately.
9+
10+
puts "Warning this will delete ALL repositories from the account pointed by GITHUB_USER environment variable"
11+
puts "The account name(login) is #{ENV["GITHUB_USER"]}"
12+
puts "Do you want to continue [N/y]"
13+
option = gets
14+
if option.chop == "y"
15+
puts "Deleting"
16+
while true
17+
response=request("users/#{ENV["GITHUB_USER"]}/repos",:get,{},true)
18+
repos=JSON.load(response.body)
19+
if repos.length == 0
20+
puts "Exiting"
21+
break
22+
end
23+
repos.each do |repo|
24+
puts "Deleting #{repo["full_name"]}"
25+
delete_repo(repo["full_name"])
26+
end
27+
end
28+
else
29+
puts 'Not deleting'
30+
end

0 commit comments

Comments
 (0)