From a9bb5b91013b1942fc1a34212dbfaab9f1eaf78c Mon Sep 17 00:00:00 2001
From: Norbert Szulc <norbert@icetek.io>
Date: Thu, 29 Feb 2024 12:38:00 +0100
Subject: [PATCH] fix(workers/repository): defensive assignment in
 patchConfigForArtifactsUpdate (#27639)

---
 lib/workers/repository/update/branch/get-updated.ts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/workers/repository/update/branch/get-updated.ts b/lib/workers/repository/update/branch/get-updated.ts
index 7088209455..e3dbf85f77 100644
--- a/lib/workers/repository/update/branch/get-updated.ts
+++ b/lib/workers/repository/update/branch/get-updated.ts
@@ -379,8 +379,12 @@ function patchConfigForArtifactsUpdate(
     const packageFile = managerPackageFiles.find(
       (p) => p.packageFile === packageFileName,
     );
-    if (packageFile) {
-      updatedConfig.lockFiles ??= packageFile.lockFiles;
+    if (
+      packageFile &&
+      is.nonEmptyArray(updatedConfig.lockFiles) &&
+      is.nonEmptyArray(packageFile.lockFiles)
+    ) {
+      updatedConfig.lockFiles = packageFile.lockFiles;
     }
   }
   return updatedConfig;
-- 
GitLab