Skip to content

Instantly share code, notes, and snippets.

@Balamir
Last active October 28, 2017 15:08
Show Gist options
  • Save Balamir/20323842dfb7f19d8b993baf086c4733 to your computer and use it in GitHub Desktop.
Save Balamir/20323842dfb7f19d8b993baf086c4733 to your computer and use it in GitHub Desktop.
Bulk Github repo deletion
# Create your delete_repo token -> https://github.com/settings/tokens
while read repo
do
curl -X DELETE -H "Authorization: token YOUR_DELETE_REPO_TOKEN" "https://api.github.com/repos/$repo"
done < repos.txt
var listRepositories = function (username) {
function getURLs() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
if(xmlhttp.status == 200){
var repositories = JSON.parse(xmlhttp.responseText);
// var foundLib = repositories.reduce(function (found, item) {
// console.log(found, item);
// }, undefined);
var final = [];
if (repositories) {
console.log('repositories', repositories);
for (var i = 0; i < repositories.length; i++) {
// console.log('repository', repositories[i].full_name);
final.push(repositories[i].full_name);
}
console.log('final', final);
} else {
console.log('username "' + username + '" not found');
}
}
else { console.log(XMLHttpRequestlhttp.status)}
}
}
var searchString = 'https://api.github.com/users/'+ username +'/repos?per_page=900';
xmlhttp.open("GET", searchString, true);
xmlhttp.send();
}
getURLs();
}
//listRepositories('username');
//save list to repos.txt file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment