Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feature(repository): add listPullRequestCommits#425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
noansknv wants to merge1 commit intogithub-tools:master
base:master
Choose a base branch
Loading
fromnoansknv:list-pr-commits
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletionslib/Repository.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,6 +119,17 @@ class Repository extends Requestable {
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/files`, null, cb);
}

/**
* List the commits of a specific pull request
* @see https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
* @param {number|string} number - the PR you wish to fetch
* @param {Requestable.callback} [cb] - will receive the list of commits from the API
* @return {Promise} - the promise for the http request
*/
listPullRequestCommits(number, cb) {
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/commits`, null, cb);
}

/**
* Compare two branches/commits/repositories
* @see https://developer.github.com/v3/repos/commits/#compare-two-commits
Expand Down
14 changes: 13 additions & 1 deletiontest/repository.spec.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ describe('Repository', function() {
let imageBlob;
const testRepoName = getTestRepoName();
const v10SHA = '20fcff9129005d14cc97b9d59b8a3d37f4fb633b';
const testPRNumber = 153;
const statusUrl =
'https://api.github.com/repos/github-tools/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b';

Expand DownExpand Up@@ -479,10 +480,21 @@ describe('Repository', function() {
}));
});

it('should list pull request commits', function(done) {
const repo = github.getRepo('github-tools', 'github');
repo.listPullRequestCommits(testPRNumber, assertSuccessful(done, function(err, commits) {
expect(commits).to.be.an.array();
expect(commits).to.have.length(1);
expect(commits[0]).to.have.own('sha');

done();
}));
});

it('should get pull requests on repo', function(done) {
const repo = github.getRepo('github-tools', 'github');

repo.getPullRequest(153, assertSuccessful(done, function(err, pr) {
repo.getPullRequest(testPRNumber, assertSuccessful(done, function(err, pr) {
expect(pr).to.have.own('title');
expect(pr).to.have.own('body');
expect(pr).to.have.own('url');
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp