Skip to content

Commit 11e74f5

Browse files
author
brandon
committed
implement getCombinedStatus
1 parent c801dda commit 11e74f5

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/Repository.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,17 @@ class Repository extends Requestable {
234234
return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/statuses`, null, cb);
235235
}
236236

237+
/**
238+
* Get the combined view of commit statuses for a particular sha, branch, or tag
239+
* @see https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
240+
* @param {string} sha - the sha, branch, or tag to get the combined status for
241+
* @param {Requestable.callback} cb - will receive the combined status
242+
* @returns {Promise} - the promise for the http request
243+
*/
244+
getCombinedStatus(sha, cb) {
245+
return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/status`, null, cb);
246+
}
247+
237248
/**
238249
* Get a description of a git tree
239250
* @see https://developer.github.com/v3/git/trees/#get-a-tree

test/repository.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ describe('Repository', function() {
255255
}));
256256
});
257257

258+
it('should get combined view of commit statuses for a SHA from a repo', function(done) {
259+
remoteRepo.getCombinedStatus(v10SHA, assertSuccessful(done, function(err, combinedStatusesView) {
260+
expect(combinedStatusesView.sha).to.equal(v10SHA);
261+
expect(combinedStatusesView.state).to.equal('success');
262+
expect(combinedStatusesView.statuses[0].context).to.equal('continuous-integration/travis-ci/push');
263+
expect(combinedStatusesView.total_count).to.equal(1);
264+
265+
done();
266+
}));
267+
});
268+
258269
it('should get a SHA from a repo', function(done) {
259270
remoteRepo.getSha('master', '.gitignore', assertSuccessful(done));
260271
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy