[Pkg-javascript-commits] [node-coveralls] 203/332: CI_PULL_REQUEST is just the url for the entire PR, have to split it and grab the number there. CIRCLE_PR_NUMBER is only defined for forks.

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:54:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit fba900513bb8653d8d83b7c35053be72d519d5d6
Author: Josh Callender <jcallender at change.org>
Date:   Fri Apr 24 12:57:16 2015 -0700

    CI_PULL_REQUEST is just the url for the entire PR, have to split it and
    grab the number there. CIRCLE_PR_NUMBER is only defined for forks.
---
 lib/getOptions.js  | 6 +++++-
 test/getOptions.js | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/getOptions.js b/lib/getOptions.js
index 4289ad9..e729e53 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -35,7 +35,11 @@ var getBaseOptions = function(cb){
   if (process.env.CIRCLECI){
     options.service_name = 'circleci';
     options.service_job_id = process.env.CIRCLE_BUILD_NUM;
-    options.service_pull_request = process.env.CI_PULL_REQUEST;
+
+    if (process.env.CI_PULL_REQUEST) {
+      var pr = process.env.CI_PULL_REQUEST.split('/pull/');
+      options.service_pull_request = pr[1];
+    }
     git_commit = process.env.CIRCLE_SHA1;
     git_branch = process.env.CIRCLE_BRANCH;
   }
diff --git a/test/getOptions.js b/test/getOptions.js
index 12505a1..05f9657 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -286,7 +286,7 @@ var testCircleCi = function(sut, done){
   sut(function(err, options){
     options.service_name.should.equal("circleci");
     options.service_job_id.should.equal("1234");
-    options.service_pull_request.should.equal('http://github.com/node-coveralls/pull/3');
+    options.service_pull_request.should.equal('3');
     options.git.should.eql({ head:
                                { id: 'e3e3e3e3e3e3e3e3e',
                                  author_name: 'Unknown Author',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list