Skip to content
Snippets Groups Projects
Unverified Commit 8fc50ca8 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(templates): compile groupSlug (#27927)

parent 744e949a
Branches
Tags 37.244.1
No related merge requests found
...@@ -31,14 +31,15 @@ describe('workers/repository/updates/branch-name', () => { ...@@ -31,14 +31,15 @@ describe('workers/repository/updates/branch-name', () => {
it('uses groupSlug if defined', () => { it('uses groupSlug if defined', () => {
const upgrade: RenovateConfig = { const upgrade: RenovateConfig = {
groupName: 'some group name', groupName: 'some group name',
groupSlug: 'some group slug', groupSlug: 'some group {{parentDir}}',
parentDir: 'abc',
group: { group: {
branchName: '{{groupSlug}}-{{branchTopic}}', branchName: '{{groupSlug}}-{{branchTopic}}',
branchTopic: 'grouptopic', branchTopic: 'grouptopic',
}, },
}; };
generateBranchName(upgrade); generateBranchName(upgrade);
expect(upgrade.branchName).toBe('some-group-slug-grouptopic'); expect(upgrade.branchName).toBe('some-group-abc-grouptopic');
}); });
it('separates major with groups', () => { it('separates major with groups', () => {
......
...@@ -54,7 +54,12 @@ export function generateBranchName(update: RenovateConfig): void { ...@@ -54,7 +54,12 @@ export function generateBranchName(update: RenovateConfig): void {
logger.trace( logger.trace(
`Dependency ${update.depName!} is part of group ${update.groupName}`, `Dependency ${update.depName!} is part of group ${update.groupName}`,
); );
update.groupSlug = slugify(update.groupSlug ?? update.groupName, { if (update.groupSlug) {
update.groupSlug = template.compile(update.groupSlug, update);
} else {
update.groupSlug = update.groupName;
}
update.groupSlug = slugify(update.groupSlug, {
lower: true, lower: true,
}); });
if (update.updateType === 'major' && update.separateMajorMinor) { if (update.updateType === 'major' && update.separateMajorMinor) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment