Created
May 23, 2015 19:16
-
-
Save touhonoob/2e3a532eebc75630c18e to your computer and use it in GitHub Desktop.
Unstar All Github Starred Repos
This file contains hidden or 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
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