From ebdf81932a85780e06d1e060e4ec72283be50be9 Mon Sep 17 00:00:00 2001 From: Johannes Feichtner <343448+Churro@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:51:17 +0100 Subject: [PATCH] fix: ensure packageFiles isn't null during dependency extraction (#32570) --- lib/workers/repository/process/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/workers/repository/process/index.ts b/lib/workers/repository/process/index.ts index 8fb4ef3b0ebb2c..f06b11e87cd42a 100644 --- a/lib/workers/repository/process/index.ts +++ b/lib/workers/repository/process/index.ts @@ -119,7 +119,7 @@ export async function extractDependencies( let res: ExtractResult = { branches: [], branchList: [], - packageFiles: null!, + packageFiles: {}, }; if (GlobalConfig.get('platform') !== 'local' && config.baseBranches?.length) { config.baseBranches = unfoldBaseBranches( @@ -146,7 +146,10 @@ export async function extractDependencies( const baseBranchRes = await lookup(baseBranchConfig, packageFiles); res.branches = res.branches.concat(baseBranchRes?.branches); res.branchList = res.branchList.concat(baseBranchRes?.branchList); - res.packageFiles = res.packageFiles || baseBranchRes?.packageFiles; // Use the first branch + if (!res.packageFiles || !Object.keys(res.packageFiles).length) { + // Use the first branch + res.packageFiles = baseBranchRes?.packageFiles; + } } } removeMeta(['baseBranch']);