Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/git/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions docs/git-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 26 additions & 22 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
}

Expand Down