Skip to content
Snippets Groups Projects
Commit f042c8db authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: keep version in commitMessage/prTitle when grouping with types

parent 13484c6f
Branches
Tags
No related merge requests found
...@@ -3,7 +3,7 @@ const semver = require('semver'); ...@@ -3,7 +3,7 @@ const semver = require('semver');
const { mergeChildConfig } = require('../../../config'); const { mergeChildConfig } = require('../../../config');
function generateBranchConfig(branchUpgrades) { function generateBranchConfig(branchUpgrades) {
logger.debug(`generateBranchConfig()`); logger.debug({ length: branchUpgrades.length }, `generateBranchConfig()`);
logger.trace({ config: branchUpgrades }); logger.trace({ config: branchUpgrades });
const config = { const config = {
upgrades: [], upgrades: [],
...@@ -39,7 +39,15 @@ function generateBranchConfig(branchUpgrades) { ...@@ -39,7 +39,15 @@ function generateBranchConfig(branchUpgrades) {
// Delete group config regardless of whether it was applied // Delete group config regardless of whether it was applied
delete upgrade.group; delete upgrade.group;
delete upgrade.lazyGrouping; delete upgrade.lazyGrouping;
if (newVersion.length > 1) { const isTypesGroup =
depNames.length === 2 &&
!hasGroupName &&
((branchUpgrades[0].depName.startsWith('@types/') &&
branchUpgrades[0].depName.endsWith(branchUpgrades[1].depName)) ||
(branchUpgrades[1].depName.startsWith('@types/') &&
branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName)));
if (newVersion.length > 1 && !isTypesGroup) {
logger.debug({ newVersion });
delete upgrade.commitMessageExtra; delete upgrade.commitMessageExtra;
upgrade.recreateClosed = true; upgrade.recreateClosed = true;
} else if (semver.valid(newVersion[0])) { } else if (semver.valid(newVersion[0])) {
...@@ -81,6 +89,7 @@ function generateBranchConfig(branchUpgrades) { ...@@ -81,6 +89,7 @@ function generateBranchConfig(branchUpgrades) {
upgrade.commitBody upgrade.commitBody
)(upgrade)}`; )(upgrade)}`;
} }
logger.debug(`commitMessage: ` + JSON.stringify(upgrade.commitMessage));
if (upgrade.prTitle) { if (upgrade.prTitle) {
upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade); upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade);
upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade); upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade);
...@@ -98,7 +107,7 @@ function generateBranchConfig(branchUpgrades) { ...@@ -98,7 +107,7 @@ function generateBranchConfig(branchUpgrades) {
upgrade.baseBranches && upgrade.baseBranches.length > 1 upgrade.baseBranches && upgrade.baseBranches.length > 1
? ' ({{baseBranch}})' ? ' ({{baseBranch}})'
: ''; : '';
logger.debug(`prTitle: ` + JSON.stringify(upgrade.prTitle));
// Compile again to allow for nested handlebars templates // Compile again to allow for nested handlebars templates
upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade); upgrade.prTitle = handlebars.compile(upgrade.prTitle)(upgrade);
logger.debug(`${upgrade.branchName}, ${upgrade.prTitle}`); logger.debug(`${upgrade.branchName}, ${upgrade.prTitle}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment