Skip to content

Instantly share code, notes, and snippets.

@touhonoob
Created May 23, 2015 19:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save touhonoob/2e3a532eebc75630c18e to your computer and use it in GitHub Desktop.
Save touhonoob/2e3a532eebc75630c18e to your computer and use it in GitHub Desktop.
Unstar All Github Starred Repos
var github = require('github');
var util = require('util');
const TOKEN = "";
const USER = "";
var g = new github({version: "3.0.0"});
g.authenticate({
type: "oauth",
token: TOKEN
});
g.repos.getStarredFromUser({
user: USER,
page: 0
}, cb);
function cb(err, res) {
if(util.isArray(res)) {
res.forEach(function(repo) {
g.repos.unStar({
user: repo.owner.login,
repo: repo.name
}, function() {
console.log("unStar " + repo.full_name);
});
});
}
if(g.hasNextPage(res.meta.link)) {
g.getNextPage(res.meta.link, cb);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment