1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-23 10:58:01 +02:00

Revise isGhes logic (#963)

* Revise `isGhes` logic

* ran `npm run format`

* add unit test

* ran `npm run format`
This commit is contained in:
John Wesley Walker III 2024-10-21 18:42:17 +02:00 committed by GitHub
parent 19dfb7b659
commit f4c5a1183d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 2 deletions

View file

@ -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 {