Created
March 12, 2013 16:25
-
-
Save maxmechanic/5144343 to your computer and use it in GitHub Desktop.
Move a user's starred GitHub repos to Pinboard via Node.js
This file contains 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 GitHubApi = require('github'); | |
var Pinboard = require('node-pinboard'); | |
var _ = require('underscore'); | |
var github = new GitHubApi({ | |
version: "3.0.0" | |
}); | |
var api_token = "user:NNNNNN"; | |
var pinboard = new Pinboard(api_token); | |
var githubUser = 'user'; | |
github.repos.getWatchedFromUser({ | |
user: githubUser, | |
per_page: 100 //if there's more than one page (total repos > per_page), might need to play with 'page' in this obj | |
}, function(err, res) { | |
if (err) {return error.console(err);} | |
_.each(res, function(repo) { | |
var options = { | |
url: repo.url, | |
description: repo.name, | |
tags: ('fromStarred,GitHub,u:' + githubUser), | |
extended: repo.description | |
}; | |
pinboard.add(options, function(res) { | |
console.log(res); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment