diff --git a/lib/workers/repository/updates/branch-name.spec.ts b/lib/workers/repository/updates/branch-name.spec.ts
index 07c368946e8afc169d21e45ea3dc24afb775b7d3..dbebba802078f5c92d729c469f67ee3bcfa0148c 100644
--- a/lib/workers/repository/updates/branch-name.spec.ts
+++ b/lib/workers/repository/updates/branch-name.spec.ts
@@ -15,6 +15,19 @@ describe('workers/repository/updates/branch-name', () => {
       expect(upgrade.branchName).toBe('some-group-name-grouptopic');
     });
 
+    it('compile groupName before slugging', () => {
+      const upgrade: RenovateConfig = {
+        groupName: '{{parentDir}}',
+        parentDir: 'myService',
+        group: {
+          branchName: '{{groupSlug}}-{{branchTopic}}',
+          branchTopic: 'grouptopic',
+        },
+      };
+      generateBranchName(upgrade);
+      expect(upgrade.branchName).toBe('myservice-grouptopic');
+    });
+
     it('uses groupSlug if defined', () => {
       const upgrade: RenovateConfig = {
         groupName: 'some group name',
diff --git a/lib/workers/repository/updates/branch-name.ts b/lib/workers/repository/updates/branch-name.ts
index a41e1051aa7d65c09ecc55277ef51e6105431a00..6ce472bbd2548bea2455514b6dd138c80a285afb 100644
--- a/lib/workers/repository/updates/branch-name.ts
+++ b/lib/workers/repository/updates/branch-name.ts
@@ -48,6 +48,7 @@ function cleanBranchName(
 export function generateBranchName(update: RenovateConfig): void {
   // Check whether to use a group name
   if (update.groupName) {
+    update.groupName = template.compile(update.groupName, update);
     logger.trace('Using group branchName template');
     // TODO: types (#22198)
     logger.trace(