Skip to content

Instantly share code, notes, and snippets.

@maxmechanic
Created March 12, 2013 16:25
Show Gist options
  • Save maxmechanic/5144343 to your computer and use it in GitHub Desktop.
Save maxmechanic/5144343 to your computer and use it in GitHub Desktop.
Move a user's starred GitHub repos to Pinboard via Node.js
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