From 85c3b134c6588513f5a05785dc0f8b4323b273c3 Mon Sep 17 00:00:00 2001 From: jamsinclair Date: Sat, 12 Nov 2016 17:53:10 +1300 Subject: [PATCH 1/2] add method to retrieve combined commit status from api --- lib/Repository.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Repository.js b/lib/Repository.js index fb200397..63dc7538 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -231,6 +231,17 @@ class Repository extends Requestable { return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/statuses`, null, cb); } + /** + * Get the combined commit Status for a specific sha, branch or tag + * @see https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + * @param {string} sha - the sha, branch, or tag to get statuses for + * @param {Requestable.callback} cb - will receive the list of statuses + * @return {Promise} - the promise for the http request + */ + getCombinedStatus(sha, cb) { + return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/status`, null, cb); + } + /** * Get a description of a git tree * @see https://developer.github.com/v3/git/trees/#get-a-tree From 7c1f28d3faf1b0eb4072f9c151bd1e4f023adf1b Mon Sep 17 00:00:00 2001 From: jamsinclair Date: Sat, 12 Nov 2016 18:20:31 +1300 Subject: [PATCH 2/2] add a test case for new getCombinedStatus method --- test/repository.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/repository.spec.js b/test/repository.spec.js index ef5101cf..eed13de9 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -239,6 +239,21 @@ describe('Repository', function() { })); }); + it('should get the combined status for a SHA from a repo', function(done) { + remoteRepo.getCombinedStatus(v10SHA, assertSuccessful(done, function(err, combinedStatus) { + expect(combinedStatus).to.be.an.object(); + expect(combinedStatus).to.have.property('state'); + expect(combinedStatus.state).to.equal('success'); + + expect(combinedStatus).to.have.property('statuses'); + expect(combinedStatus.statuses).to.be.an.array(); + expect(combinedStatus.statuses.length).to.equal(1); + expect(combinedStatus.statuses[0].url).to.equal(statusUrl); + + done(); + })); + }); + it('should get a SHA from a repo', function(done) { remoteRepo.getSha('master', '.gitignore', assertSuccessful(done)); }); 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