Skip to content

Commit

Permalink
fix: choose branch instead of prBranch when noCi is true
Browse files Browse the repository at this point in the history
  • Loading branch information
dcneiner committed Jul 10, 2020
1 parent b5c9dea commit 3ced2d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Expand Up @@ -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, {
Expand Down

0 comments on commit 3ced2d5

Please sign in to comment.