diff --git a/components/git/release.js b/components/git/release.js index bc5770eb..c74ba5ab 100644 --- a/components/git/release.js +++ b/components/git/release.js @@ -25,6 +25,10 @@ const releaseOptions = { describe: 'Labels separated by "," to filter security PRs', type: 'string' }, + skipBranchDiff: { + describe: 'Skips the initial branch-diff check when preparing releases', + type: 'boolean' + }, startLTS: { describe: 'Mark the release as the transition from Current to LTS', type: 'boolean' diff --git a/docs/git-node.md b/docs/git-node.md index 2d0f3bac..30643e3b 100644 --- a/docs/git-node.md +++ b/docs/git-node.md @@ -247,6 +247,11 @@ git node release --prepare --startLTS git node release --prepare --security --filterLabel 18.x 18.20.1 ``` +``` +# Skip the branch-diff initial check (useful when updating ongoing proposals) +git node release --prepare 1.2.3 --skipBranchDiff +``` + ## `git node sync` Demo: https://asciinema.org/a/221230 diff --git a/lib/prepare_release.js b/lib/prepare_release.js index 3185b219..abd8303f 100644 --- a/lib/prepare_release.js +++ b/lib/prepare_release.js @@ -29,6 +29,7 @@ export default class ReleasePreparation { this.isSecurityRelease = argv.security; this.isLTS = false; this.isLTSTransition = argv.startLTS; + this.runBranchDiff = !argv.skipBranchDiff; this.ltsCodename = ''; this.date = ''; this.config = getMergedConfig(this.dir); @@ -202,31 +203,34 @@ export default class ReleasePreparation { this.config.repo = 'node-private'; return this.prepareSecurity(); } - // TODO: UPDATE re-use - // Check the branch diff to determine if the releaser - // wants to backport any more commits before proceeding. - cli.startSpinner('Fetching branch-diff'); - const raw = this.getBranchDiff({ - onlyNotableChanges: false, - comparisonBranch: newVersion - }); - const diff = raw.split('*'); - cli.stopSpinner('Got branch diff'); + if (this.runBranchDiff) { + // TODO: UPDATE re-use + // Check the branch diff to determine if the releaser + // wants to backport any more commits before proceeding. + cli.startSpinner('Fetching branch-diff'); + const raw = this.getBranchDiff({ + onlyNotableChanges: false, + comparisonBranch: newVersion + }); - const outstandingCommits = diff.length - 1; - if (outstandingCommits !== 0) { - const staging = `v${semver.major(newVersion)}.x-staging`; - const proceed = await cli.prompt( - `There are ${outstandingCommits} commits that may be ` + - `backported to ${staging} - do you still want to proceed?`, - { defaultAnswer: false }); + const diff = raw.split('*'); + cli.stopSpinner('Got branch diff'); - if (!proceed) { - const seeDiff = await cli.prompt( - 'Do you want to see the branch diff?'); - if (seeDiff) cli.log(raw); - return; + const outstandingCommits = diff.length - 1; + if (outstandingCommits !== 0) { + const staging = `v${semver.major(newVersion)}.x-staging`; + const proceed = await cli.prompt( + `There are ${outstandingCommits} commits that may be ` + + `backported to ${staging} - do you still want to proceed?`, + { defaultAnswer: false }); + + if (!proceed) { + const seeDiff = await cli.prompt( + 'Do you want to see the branch diff?'); + if (seeDiff) cli.log(raw); + return; + } } }