forked from subodh-dharma/star-index
-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.js
33 lines (26 loc) · 873 Bytes
/
github.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var git = require('octonode');
var gitclient = git.client();
var ghuser = gitclient.user('chrisparnin');
var star_summary = [];
getRepoStarCount(ghuser);
function getRepoStarCount(ghuser) {
return new Promise(function(resolve, reject) {
ghuser.repos(function(error, repos, headers) {
for (repo in repos) {
//console.log(JSON.stringify(repos[repo], null, 4));
var r = repos[repo];
if (r.stargazers_count != 0) {
star_summary.push({
'name': r.name,
'star_count': r.stargazers_count,
'forks': r.forks
});
}
console.log(JSON.stringify(star_summary, null, 4));
//console.log("Repository: " + r.name, "\tStarred by " + r.stargazers_count + " developer(s)");
}
resolve(star_summary);
});
});
}
exports.getRepoStarCount = getRepoStarCount;