diff --git a/lib/Repository.js b/lib/Repository.js index 301e1230..b99c8d44 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -803,6 +803,17 @@ class Repository extends Requestable { mergePullRequest(number, options, cb) { return this._request('PUT', `/repos/${this.__fullname}/pulls/${number}/merge`, options, cb); } + + /** + * List review comments on an pull request + * @see https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request + * @param {number|string} number - the number of the pull request to get review comments from + * @param {Requestable.callback} [cb] - will receive the comments + * @return {Promise} - the promise for the http request + */ + listPullRequestReviewComments(number, cb) { + return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/comments`, null, cb); + } } module.exports = Repository; diff --git a/test/repository.spec.js b/test/repository.spec.js index f747878d..1b08a46d 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -240,6 +240,16 @@ describe('Repository', function() { done(); })); }); + + it('should list review comments', function(done) { + const repo = github.getRepo('michael', 'github'); + + repo.listPullRequestReviewComments(401, assertSuccessful(done, function(err, reviewComments) { + expect(reviewComments).to.be.an.array(); + //expect(reviewComments[0]).to.have.own('body', 'Comment test'); //TODO: Need to establish a test PR with test review comments + done(); + })); + }); }); describe('creating/modifiying', function() {