Skip to content

Instantly share code, notes, and snippets.

@rchampourlier
Created April 15, 2012 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchampourlier/2394410 to your computer and use it in GitHub Desktop.
Save rchampourlier/2394410 to your computer and use it in GitHub Desktop.
Examples for issue with ajaxorg/node-github
var GitHubApi = require("github");
var user = "ajaxorg";
var repos = ["ace", "cloud9"];
var github = new GitHubApi({
version: "3.0.0"
});
repos.forEach(function(repo) {
var github = new GitHubApi({
version: "3.0.0"
});
github.gitdata.getReference({
user: user,
repo: repo,
ref: "heads/master"
}, function(err, res) {
console.log(res);
});
});
$ node correct.js
{ url: 'https://api.github.com/repos/ajaxorg/ace/git/refs/heads/master',
ref: 'refs/heads/master',
object:
{ type: 'commit',
url: 'https://api.github.com/repos/ajaxorg/ace/git/commits/e80a862f3e4fa1de77d881b04e3e207d04443498',
sha: 'e80a862f3e4fa1de77d881b04e3e207d04443498' },
meta: { 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4986' } }
{ url: 'https://api.github.com/repos/ajaxorg/cloud9/git/refs/heads/master',
object:
{ type: 'commit',
url: 'https://api.github.com/repos/ajaxorg/cloud9/git/commits/e89343115bb2f5faf2c17e2714ca12275424703d',
sha: 'e89343115bb2f5faf2c17e2714ca12275424703d' },
ref: 'refs/heads/master',
meta: { 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4985' } }
$ node wrong.js
{ url: 'https://api.github.com/repos/ajaxorg/ace/git/refs/heads/master',
ref: 'refs/heads/master',
object:
{ type: 'commit',
url: 'https://api.github.com/repos/ajaxorg/ace/git/commits/e80a862f3e4fa1de77d881b04e3e207d04443498',
sha: 'e80a862f3e4fa1de77d881b04e3e207d04443498' },
meta: { 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4984' } }
{ url: 'https://api.github.com/repos/ajaxorg/ace/git/refs/heads/master',
ref: 'refs/heads/master',
object:
{ type: 'commit',
url: 'https://api.github.com/repos/ajaxorg/ace/git/commits/e80a862f3e4fa1de77d881b04e3e207d04443498',
sha: 'e80a862f3e4fa1de77d881b04e3e207d04443498' },
meta: { 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4983' } }
var GitHubApi = require("github");
var user = "ajaxorg";
var repos = ["ace", "cloud9"];
var github = new GitHubApi({
version: "3.0.0"
});
repos.forEach(function(repo) {
github.gitdata.getReference({
user: user,
repo: repo,
ref: "heads/master"
}, function(err, res) {
console.log(res);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment