fix: group based on commitMessageExtra

This commit is contained in:
Rhys Arkins 2018-04-17 11:47:22 +02:00
parent c26e1226e9
commit 8fc005b15e
2 changed files with 14 additions and 2 deletions

View file

@ -17,8 +17,11 @@ function generateBranchConfig(branchUpgrades) {
if (!depNames.includes(upg.depName)) { if (!depNames.includes(upg.depName)) {
depNames.push(upg.depName); depNames.push(upg.depName);
} }
if (!newVersion.includes(upg.newVersion || upg.newFrom)) { if (upg.commitMessageExtra) {
newVersion.push(upg.newVersion || upg.newFrom); const extra = handlebars.compile(upg.commitMessageExtra)(upg);
if (!newVersion.includes(extra)) {
newVersion.push(extra);
}
} }
}); });
const groupEligible = const groupEligible =
@ -46,6 +49,7 @@ function generateBranchConfig(branchUpgrades) {
branchUpgrades[0].depName.endsWith(branchUpgrades[1].depName)) || branchUpgrades[0].depName.endsWith(branchUpgrades[1].depName)) ||
(branchUpgrades[1].depName.startsWith('@types/') && (branchUpgrades[1].depName.startsWith('@types/') &&
branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName))); branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName)));
// istanbul ignore else
if (newVersion.length > 1 && !isTypesGroup) { if (newVersion.length > 1 && !isTypesGroup) {
logger.debug({ newVersion }); logger.debug({ newVersion });
delete upgrade.commitMessageExtra; delete upgrade.commitMessageExtra;

View file

@ -82,6 +82,8 @@ describe('workers/repository/updates/generate', () => {
groupName: 'some-group', groupName: 'some-group',
branchName: 'some-branch', branchName: 'some-branch',
prTitle: 'some-title', prTitle: 'some-title',
commitMessageExtra:
'to {{#if isMajor}}v{{newVersionMajor}}{{else}}{{#unless isRange}}v{{/unless}}{{newVersion}}{{/if}}',
lazyGrouping: true, lazyGrouping: true,
foo: 1, foo: 1,
newVersion: '5.1.2', newVersion: '5.1.2',
@ -94,6 +96,8 @@ describe('workers/repository/updates/generate', () => {
groupName: 'some-group', groupName: 'some-group',
branchName: 'some-branch', branchName: 'some-branch',
prTitle: 'some-title', prTitle: 'some-title',
commitMessageExtra:
'to {{#if isMajor}}v{{newVersionMajor}}{{else}}{{#unless isRange}}v{{/unless}}{{newVersion}}{{/if}}',
lazyGrouping: true, lazyGrouping: true,
foo: 1, foo: 1,
newVersion: '5.1.2', newVersion: '5.1.2',
@ -113,6 +117,8 @@ describe('workers/repository/updates/generate', () => {
groupName: 'some-group', groupName: 'some-group',
branchName: 'some-branch', branchName: 'some-branch',
prTitle: 'some-title', prTitle: 'some-title',
commitMessageExtra:
'to {{#if isMajor}}v{{newVersionMajor}}{{else}}{{#unless isRange}}v{{/unless}}{{newVersion}}{{/if}}',
lazyGrouping: true, lazyGrouping: true,
foo: 1, foo: 1,
newVersion: '5.1.2', newVersion: '5.1.2',
@ -125,6 +131,8 @@ describe('workers/repository/updates/generate', () => {
groupName: 'some-group', groupName: 'some-group',
branchName: 'some-branch', branchName: 'some-branch',
prTitle: 'some-title', prTitle: 'some-title',
commitMessageExtra:
'to {{#if isMajor}}v{{newVersionMajor}}{{else}}{{#unless isRange}}v{{/unless}}{{newVersion}}{{/if}}',
lazyGrouping: true, lazyGrouping: true,
foo: 1, foo: 1,
newVersion: '1.1.0', newVersion: '1.1.0',