Skip to content

Commit 95fb236

Browse files
committed
improve(repository): add list commits on pull request function
1 parent 5af1e07 commit 95fb236

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/Repository.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,23 @@ class Repository extends Requestable {
198198
return this._request('GET', `/repos/${this.__fullname}/commits`, options, cb);
199199
}
200200

201+
/**
202+
* List the commits on a pull request
203+
* @see https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
204+
* @param {number|string} number - the number of the pull request to list the commits
205+
* @param {Object} [options] - the filtering options for commits
206+
* @param {Requestable.callback} [cb] - will receive the commits information
207+
* @return {Promise} - the promise for the http request
208+
*/
209+
listCommitsOnPR(number, options, cb) {
210+
options = options || {};
211+
if (typeof options === 'function') {
212+
cb = options;
213+
options = {};
214+
}
215+
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/commits`, options, cb);
216+
}
217+
201218
/**
202219
* Gets a single commit information for a repository
203220
* @see https://developer.github.com/v3/repos/commits/#get-a-single-commit

0 commit comments

Comments
 (0)