Skip to content

Commit a72d0a9

Browse files
author
Jane Quinn
committed
added pull requests to data object
1 parent fabaff7 commit a72d0a9

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

github.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,27 @@ function cmd_query (args, done) {
9797
return done(err)
9898
}
9999
var data
100-
101100
if (repo) {
101+
var pullRequests = []
102+
github.pullRequests.getAll({user: user, repo: github_name, state: 'open'}, function (err, response) {
103+
if (err) {
104+
console.log(err)
105+
}
106+
if (response) {
107+
pullRequests = response
108+
}
109+
})
102110
data = {
103-
name: args.repo,
104-
user: args.user,
105-
repo: args.repo,
106-
stars: repo.stargazers_count,
107-
watches: repo.subscribers_count,
108-
forks: repo.forks_count,
109-
last: repo.pushed_at,
110-
url: gitUrl,
111-
gitClone: repo.clone_url
111+
name: args.repo || '',
112+
user: args.user || '',
113+
repo: args.repo || '',
114+
stars: repo.stargazers_count || '',
115+
watches: repo.subscribers_count || '',
116+
forks: repo.forks_count || '',
117+
last: repo.pushed_at || '',
118+
url: gitUrl || '',
119+
gitClone: repo.clone_url || '',
120+
pullRequests: pullRequests.length || ''
112121
}
113122
// update the data if module exists in cache, if not create it
114123
github_ent.load$(github_name, function (err, github) {

0 commit comments

Comments
 (0)