Skip to content

Commit

Permalink
fix(templates): compile groupSlug (#27927)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Mar 14, 2024
1 parent 744e949 commit 8fc50ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/workers/repository/updates/branch-name.spec.ts
Expand Up @@ -31,14 +31,15 @@ describe('workers/repository/updates/branch-name', () => {
it('uses groupSlug if defined', () => {
const upgrade: RenovateConfig = {
groupName: 'some group name',
groupSlug: 'some group slug',
groupSlug: 'some group {{parentDir}}',
parentDir: 'abc',
group: {
branchName: '{{groupSlug}}-{{branchTopic}}',
branchTopic: 'grouptopic',
},
};
generateBranchName(upgrade);
expect(upgrade.branchName).toBe('some-group-slug-grouptopic');
expect(upgrade.branchName).toBe('some-group-abc-grouptopic');
});

it('separates major with groups', () => {
Expand Down
7 changes: 6 additions & 1 deletion lib/workers/repository/updates/branch-name.ts
Expand Up @@ -54,7 +54,12 @@ export function generateBranchName(update: RenovateConfig): void {
logger.trace(
`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,
});
if (update.updateType === 'major' && update.separateMajorMinor) {
Expand Down

0 comments on commit 8fc50ca

Please sign in to comment.