Skip to content

Commit d103f28

Browse files
authored
feat(release): add skipBranchDiff option (#724)
Adds an option that allows skipping the initial `branch-diff` check step in the release command. This should be very convenient for releasers that are updating a current work in progress proposal, particularly helping avoid hitting GitHub API rate limits.
1 parent 6d68c99 commit d103f28

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

components/git/release.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const releaseOptions = {
2525
describe: 'Labels separated by "," to filter security PRs',
2626
type: 'string'
2727
},
28+
skipBranchDiff: {
29+
describe: 'Skips the initial branch-diff check when preparing releases',
30+
type: 'boolean'
31+
},
2832
startLTS: {
2933
describe: 'Mark the release as the transition from Current to LTS',
3034
type: 'boolean'

docs/git-node.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ git node release --prepare --startLTS
247247
git node release --prepare --security --filterLabel 18.x 18.20.1
248248
```
249249

250+
```
251+
# Skip the branch-diff initial check (useful when updating ongoing proposals)
252+
git node release --prepare 1.2.3 --skipBranchDiff
253+
```
254+
250255
## `git node sync`
251256

252257
Demo: https://asciinema.org/a/221230

lib/prepare_release.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class ReleasePreparation {
2929
this.isSecurityRelease = argv.security;
3030
this.isLTS = false;
3131
this.isLTSTransition = argv.startLTS;
32+
this.runBranchDiff = !argv.skipBranchDiff;
3233
this.ltsCodename = '';
3334
this.date = '';
3435
this.config = getMergedConfig(this.dir);
@@ -202,31 +203,34 @@ export default class ReleasePreparation {
202203
this.config.repo = 'node-private';
203204
return this.prepareSecurity();
204205
}
205-
// TODO: UPDATE re-use
206-
// Check the branch diff to determine if the releaser
207-
// wants to backport any more commits before proceeding.
208-
cli.startSpinner('Fetching branch-diff');
209-
const raw = this.getBranchDiff({
210-
onlyNotableChanges: false,
211-
comparisonBranch: newVersion
212-
});
213206

214-
const diff = raw.split('*');
215-
cli.stopSpinner('Got branch diff');
207+
if (this.runBranchDiff) {
208+
// TODO: UPDATE re-use
209+
// Check the branch diff to determine if the releaser
210+
// wants to backport any more commits before proceeding.
211+
cli.startSpinner('Fetching branch-diff');
212+
const raw = this.getBranchDiff({
213+
onlyNotableChanges: false,
214+
comparisonBranch: newVersion
215+
});
216216

217-
const outstandingCommits = diff.length - 1;
218-
if (outstandingCommits !== 0) {
219-
const staging = `v${semver.major(newVersion)}.x-staging`;
220-
const proceed = await cli.prompt(
221-
`There are ${outstandingCommits} commits that may be ` +
222-
`backported to ${staging} - do you still want to proceed?`,
223-
{ defaultAnswer: false });
217+
const diff = raw.split('*');
218+
cli.stopSpinner('Got branch diff');
224219

225-
if (!proceed) {
226-
const seeDiff = await cli.prompt(
227-
'Do you want to see the branch diff?');
228-
if (seeDiff) cli.log(raw);
229-
return;
220+
const outstandingCommits = diff.length - 1;
221+
if (outstandingCommits !== 0) {
222+
const staging = `v${semver.major(newVersion)}.x-staging`;
223+
const proceed = await cli.prompt(
224+
`There are ${outstandingCommits} commits that may be ` +
225+
`backported to ${staging} - do you still want to proceed?`,
226+
{ defaultAnswer: false });
227+
228+
if (!proceed) {
229+
const seeDiff = await cli.prompt(
230+
'Do you want to see the branch diff?');
231+
if (seeDiff) cli.log(raw);
232+
return;
233+
}
230234
}
231235
}
232236

0 commit comments

Comments
 (0)