From b7d1f0f64fdec0b4fc08f14a6e9c158a0020e2b6 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 11 Oct 2023 09:09:21 -0400
Subject: [PATCH] fix(platform/github): sort config hostRules before platform
 (#25135)

---
 lib/modules/platform/index.spec.ts | 12 ++++++------
 lib/modules/platform/index.ts      |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/modules/platform/index.spec.ts b/lib/modules/platform/index.spec.ts
index 0c9df4dd74..ba3eb51616 100644
--- a/lib/modules/platform/index.spec.ts
+++ b/lib/modules/platform/index.spec.ts
@@ -141,18 +141,18 @@ describe('modules/platform/index', () => {
         endpoint: 'https://api.github.com/',
         gitAuthor: 'user@domain.com',
         hostRules: [
-          {
-            hostType: 'github',
-            matchHost: 'github.com',
-            token: '456',
-            username: 'def',
-          },
           {
             hostType: 'docker',
             matchHost: 'ghcr.io',
             password: '123',
             username: 'USERNAME',
           },
+          {
+            hostType: 'github',
+            matchHost: 'github.com',
+            token: '456',
+            username: 'def',
+          },
           {
             hostType: 'github',
             matchHost: 'api.github.com',
diff --git a/lib/modules/platform/index.ts b/lib/modules/platform/index.ts
index 7c9b4bc4df..d06cc3fdf4 100644
--- a/lib/modules/platform/index.ts
+++ b/lib/modules/platform/index.ts
@@ -51,8 +51,8 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> {
     ...config,
     ...platformInfo,
     hostRules: [
-      ...(config.hostRules ?? []),
       ...(platformInfo?.hostRules ?? []),
+      ...(config.hostRules ?? []),
     ],
   };
   // istanbul ignore else
-- 
GitLab