Skip to content

Commit 598d2c7

Browse files
authored
Merge pull request #580 from bfeldkamp3/master
implement getCombinedStatus
2 parents c801dda + 295a16d commit 598d2c7

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-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/issue.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ describe('Issue', function() {
241241
it('should update a label', (done) => {
242242
let label = {
243243
color: '789abc',
244+
name: createdLabel
244245
};
245246

246247
expect(createdLabel).to.be.a.string();

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)