Refine `isGhes` logic (#697) · eFog-R/setup-java@8df1039 · GitHub
Skip to content

Commit 8df1039

Browse files
authored
Refine isGhes logic (actions#697)
1 parent 870c199 commit 8df1039

4 files changed

Lines changed: 57 additions & 4 deletions

File tree

‎__tests__/util.test.ts‎

Lines changed: 40 additions & 1 deletion

‎dist/cleanup/index.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88552,7 +88552,11 @@ function isJobStatusSuccess() {
8855288552
exports.isJobStatusSuccess = isJobStatusSuccess;
8855388553
function isGhes() {
8855488554
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
88555-
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
88555+
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
88556+
const isGitHubHost = hostname === 'GITHUB.COM';
88557+
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
88558+
const isLocalHost = hostname.endsWith('.LOCALHOST');
88559+
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
8855688560
}
8855788561
exports.isGhes = isGhes;
8855888562
function isCacheFeatureAvailable() {

‎dist/setup/index.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126328,7 +126328,11 @@ function isJobStatusSuccess() {
126328126328
exports.isJobStatusSuccess = isJobStatusSuccess;
126329126329
function isGhes() {
126330126330
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
126331-
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
126331+
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
126332+
const isGitHubHost = hostname === 'GITHUB.COM';
126333+
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
126334+
const isLocalHost = hostname.endsWith('.LOCALHOST');
126335+
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
126332126336
}
126333126337
exports.isGhes = isGhes;
126334126338
function isCacheFeatureAvailable() {

‎src/util.ts‎

Lines changed: 7 additions & 1 deletion

0 commit comments

Comments
 (0)