fix: use correct ci branch context (#1521)

This commit is contained in:
Emmanuel Ogbizi 2020-06-25 12:30:12 -04:00 committed by GitHub
parent a4658016d9
commit 0f0c650b41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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.');

View File

@ -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(