From d0c05c9c6b9600b0abaaff1c7bb711b98c095488 Mon Sep 17 00:00:00 2001
From: Ben Brown <ben@demerara.io>
Date: Fri, 21 Feb 2025 03:47:10 +0000
Subject: [PATCH] fix(reconfigure): massage config prior to validation (#34348)

---
 .../repository/reconfigure/validate.spec.ts   | 21 +++++++++++++++++++
 .../repository/reconfigure/validate.ts        |  4 +++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lib/workers/repository/reconfigure/validate.spec.ts b/lib/workers/repository/reconfigure/validate.spec.ts
index 730bf75e37..44525545d0 100644
--- a/lib/workers/repository/reconfigure/validate.spec.ts
+++ b/lib/workers/repository/reconfigure/validate.spec.ts
@@ -225,4 +225,25 @@ describe('workers/repository/reconfigure/validate', () => {
       state: 'green',
     });
   });
+
+  it('handles array fields which accept strings', async () => {
+    fs.readLocalFile.mockResolvedValueOnce(`
+        {
+          "packageRules": [
+            {
+              "description": "test",
+              "matchPackageNames": ["pkg"],
+              "enabled": false
+            }
+          ]
+        }
+        `);
+    await validateReconfigureBranch(config);
+    expect(platform.setBranchStatus).toHaveBeenCalledWith({
+      branchName: 'prefix/reconfigure',
+      context: 'renovate/config-validation',
+      description: 'Validation Successful',
+      state: 'green',
+    });
+  });
 });
diff --git a/lib/workers/repository/reconfigure/validate.ts b/lib/workers/repository/reconfigure/validate.ts
index ca1b6a68d6..1ad1927411 100644
--- a/lib/workers/repository/reconfigure/validate.ts
+++ b/lib/workers/repository/reconfigure/validate.ts
@@ -1,5 +1,6 @@
 import is from '@sindresorhus/is';
 import JSON5 from 'json5';
+import { massageConfig } from '../../../config/massage';
 import type { RenovateConfig } from '../../../config/types';
 import { validateConfig } from '../../../config/validation';
 import { logger } from '../../../logger';
@@ -138,7 +139,8 @@ export async function validateReconfigureBranch(
   }
 
   // perform validation and provide a passing or failing check based on result
-  const validationResult = await validateConfig('repo', configFileParsed);
+  const massagedConfig = massageConfig(configFileParsed);
+  const validationResult = await validateConfig('repo', massagedConfig);
 
   // failing check
   if (validationResult.errors.length > 0) {
-- 
GitLab