From 08d5416f0ba7da93cc1d4b50ec70de8b35d6c127 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 7 Feb 2024 08:10:13 +0000
Subject: [PATCH] feat(cache): cache http response for files in same org
 (#27045)

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
---
 lib/modules/platform/github/index.ts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts
index c4f2218951..3092103176 100644
--- a/lib/modules/platform/github/index.ts
+++ b/lib/modules/platform/github/index.ts
@@ -320,9 +320,10 @@ export async function getRawFile(
   branchOrTag?: string,
 ): Promise<string | null> {
   const repo = repoName ?? config.repository;
+  const isSameOrg = repo?.split('/')?.[0] === config.repositoryOwner;
   const httpOptions: InternalHttpOptions = {
-    // Only cache response if it's from the same repo
-    repoCache: repo === config.repository,
+    // Only cache response if it's from the same org
+    repoCache: isSameOrg,
   };
   let url = `repos/${repo}/contents/${fileName}`;
   if (branchOrTag) {
-- 
GitLab