From 0beadebc68cdae8a58b2cb3cbf5bf0d0020ba6fc Mon Sep 17 00:00:00 2001 From: John Wesley Walker III <81404201+jww3@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:31:47 +0200 Subject: [PATCH] Revise `isGhes` logic --- src/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index f3aa1ef1..aac0a19b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -116,7 +116,13 @@ export function isGhes(): boolean { const ghUrl = new URL( process.env['GITHUB_SERVER_URL'] || 'https://github.com' ); - return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; + + const hostname = ghUrl.hostname.trimEnd().toUpperCase() + const isGitHubHost = hostname === 'GITHUB.COM' + const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM') + const isLocalHost = hostname.endsWith('.LOCALHOST') + + return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost } export function isCacheFeatureAvailable(): boolean {