diff --git a/index.js b/index.js index 64288cff22..4d5aaedc73 100644 --- a/index.js +++ b/index.js @@ -26,7 +26,8 @@ marked.setOptions({renderer: new TerminalRenderer()}); /* eslint complexity: off */ async function run(context, plugins) { const {cwd, env, options, logger} = context; - const {isCi, branch: ciBranch, isPr} = context.envCi; + const {isCi, branch, prBranch, isPr} = context.envCi; + const ciBranch = isPr ? prBranch : branch; if (!isCi && !options.dryRun && !options.noCi) { logger.warn('This run was not triggered in a known CI environment, running in dry-run mode.'); diff --git a/test/index.test.js b/test/index.test.js index f32d6fedf5..d2533c4919 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1258,7 +1258,7 @@ test('Allow local releases with "noCi" option', async (t) => { const semanticRelease = requireNoCache('..', { './lib/get-logger': () => t.context.logger, - 'env-ci': () => ({isCi: false, branch: 'master', isPr: true}), + 'env-ci': () => ({isCi: false, branch: 'master', isPr: false}), }); t.truthy( await semanticRelease(options, { @@ -1357,7 +1357,7 @@ test('Returns false if triggered by a PR', async (t) => { const semanticRelease = requireNoCache('..', { './lib/get-logger': () => t.context.logger, - 'env-ci': () => ({isCi: true, branch: 'master', isPr: true}), + 'env-ci': () => ({isCi: true, branch: 'master', prBranch: 'patch-1', isPr: true}), }); t.false(