Skip to content

Commit c0da7a0

Browse files
committed
fix: use Current branch instead of master for LTS comparison
1 parent 6cda82a commit c0da7a0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/prepare_release.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,22 @@ class ReleasePreparation {
443443
`backport-blocked-v${majorVersion}.x`
444444
];
445445

446+
let comparisonBranch = 'master';
446447
const isSemverMinor = versionComponents.patch === 0;
447-
if (isLTS && !isSemverMinor) {
448-
excludeLabels.push('semver-minor');
448+
if (isLTS) {
449+
// Assume current branch corresponds to the tag with highest semver value.
450+
const tags = runSync('git' ['tag', '-l', '--sort', '-version:refname']).trim();
451+
const highestVersionTag = tags.split('\n')[0];
452+
comparisonBranch = `v${semver.coerce(highestVersionTag).major}.x`
453+
454+
if (!isSemverMinor) {
455+
excludeLabels.push('semver-minor');
456+
}
449457
}
450458

451459
branchDiffOptions = [
452460
stagingBranch,
453-
// TODO(codebytere): use Current branch instead of master for LTS
454-
'master',
461+
comparisonBranch,
455462
`--exclude-label=${excludeLabels.join(',')}`,
456463
'--filter-release'
457464
];

0 commit comments

Comments
 (0)