From 6de815e82f232049c2ab50b06ef5cf242c76ce85 Mon Sep 17 00:00:00 2001
From: Sergei Zharinov <zharinov@users.noreply.github.com>
Date: Wed, 21 Jun 2023 11:05:22 +0300
Subject: [PATCH] fix(rubygems): Cache versions endpoing only for
 `rubygems.org` host (#22906)

---
 lib/modules/datasource/rubygems/versions-endpoint-cache.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/modules/datasource/rubygems/versions-endpoint-cache.ts b/lib/modules/datasource/rubygems/versions-endpoint-cache.ts
index d4bdde1a90..90f0849362 100644
--- a/lib/modules/datasource/rubygems/versions-endpoint-cache.ts
+++ b/lib/modules/datasource/rubygems/versions-endpoint-cache.ts
@@ -6,6 +6,7 @@ import type { HttpOptions } from '../../../util/http/types';
 import { newlineRegex } from '../../../util/regex';
 import { LooseArray } from '../../../util/schema-utils';
 import { copystr } from '../../../util/string';
+import { parseUrl } from '../../../util/url';
 
 interface VersionsEndpointUnsupported {
   versionsEndpointSupported: false;
@@ -155,7 +156,11 @@ export class VersionsEndpointCache {
     } else {
       newCache = oldCache;
     }
-    memCache.set(cacheKey, newCache);
+
+    const registryHostname = parseUrl(registryUrl)?.hostname;
+    if (registryHostname === 'rubygems.org') {
+      memCache.set(cacheKey, newCache);
+    }
     return newCache;
   }
 
-- 
GitLab