diff --git a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
index d7d7e0e4ddd013ceffedb3d0f726749f5ce084a0..fb2c6bcda085abcb4c41c0672d183c2899a560c6 100644
--- a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
+++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
@@ -1,6 +1,7 @@
 // TODO #7154
 import is from '@sindresorhus/is';
 import minimatch from 'minimatch';
+import { mergeChildConfig } from '../../../../config';
 import { GlobalConfig } from '../../../../config/global';
 import { addMeta, logger } from '../../../../logger';
 import type { ArtifactError } from '../../../../modules/manager/types';
@@ -66,7 +67,7 @@ export async function postUpgradeCommandsExecutor(
         ) {
           try {
             const compiledCmd = allowPostUpgradeCommandTemplating
-              ? compile(cmd, upgrade)
+              ? compile(cmd, mergeChildConfig(config, upgrade))
               : cmd;
 
             logger.debug({ cmd: compiledCmd }, 'Executing post-upgrade task');