From 3ced2d5558dd8dfc70d2c20141d09352c24269d5 Mon Sep 17 00:00:00 2001 From: Doug Neiner Date: Thu, 9 Jul 2020 23:30:27 -0500 Subject: [PATCH] fix: choose branch instead of prBranch when noCi is true fix #1596 --- index.js | 2 +- test/index.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 4d5aaedc73..08c42b5902 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ marked.setOptions({renderer: new TerminalRenderer()}); async function run(context, plugins) { const {cwd, env, options, logger} = context; const {isCi, branch, prBranch, isPr} = context.envCi; - const ciBranch = isPr ? prBranch : branch; + const ciBranch = isPr && !options.noCi ? 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 d2533c4919..74fee8ee96 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: false}), + 'env-ci': () => ({isCi: false, branch: 'master', isPr: true, prBranch: 'refs/pull/4/merge'}), }); t.truthy( await semanticRelease(options, {