Skip to content

Commit

Permalink
fix: fix CircleCi PR detection
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Jun 5, 2019
1 parent 8f5cd22 commit f49ac93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions services/circleci.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables

const {prNumber} = require('../lib/utils');

module.exports = {
detect({env}) {
return Boolean(env.CIRCLECI);
},
configuration({env}) {
const pr = env.CIRCLE_PR_NUMBER || prNumber(env.CIRCLE_PULL_REQUEST || env.CI_PULL_REQUEST);
const pr = env.CIRCLE_PR_NUMBER;
const isPr = Boolean(pr);

return {
Expand Down
4 changes: 2 additions & 2 deletions test/services/circleci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('Push', t => {

test('PR 1.0', t => {
t.deepEqual(
circle.configuration({env: Object.assign({}, env, {CIRCLE_BRANCH: 'pr-branch', CI_PULL_REQUEST: 'uri/pr/10'})}),
circle.configuration({env: Object.assign({}, env, {CIRCLE_BRANCH: 'pr-branch', CIRCLE_PR_NUMBER: '10'})}),
{
name: 'CircleCI',
service: 'circleci',
Expand All @@ -52,7 +52,7 @@ test('PR 1.0', t => {

test('PR 2.0', t => {
t.deepEqual(
circle.configuration({env: Object.assign({}, env, {CIRCLE_BRANCH: 'pr-branch', CIRCLE_PULL_REQUEST: 'uri/pr/10'})}),
circle.configuration({env: Object.assign({}, env, {CIRCLE_BRANCH: 'pr-branch', CIRCLE_PR_NUMBER: '10'})}),
{
name: 'CircleCI',
service: 'circleci',
Expand Down

0 comments on commit f49ac93

Please sign in to comment.