mirror of
https://github.com/actions/checkout.git
synced 2025-06-14 23:08:45 +08:00
Compare commits
No commits in common. "7695871fe06159c11edae34db6ecea209300fc62" and "19060a122d0c2f1ca421f732a370ce68d2fc33de" have entirely different histories.
7695871fe0
...
19060a122d
@ -4,9 +4,10 @@ describe('isGhes tests', () => {
|
|||||||
it('basics', async () => {
|
it('basics', async () => {
|
||||||
expect(urlHelper.isGhes()).toBeFalsy()
|
expect(urlHelper.isGhes()).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
|
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://contoso.ghe.com')).toBeFalsy()
|
//expect(urlHelper.isGhes('https://api.github.com')).toBeFalsy()
|
||||||
|
expect(urlHelper.isGhes('https://europe.ghe.com')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
|
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://src.onpremise.fabrikam.com')).toBeTruthy()
|
expect(urlHelper.isGhes('https://src.onpremise.customer.com')).toBeTruthy()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -19,14 +20,14 @@ describe('getServerApiUrl tests', () => {
|
|||||||
expect(urlHelper.getServerApiUrl('https://GitHub.com')).toBe(
|
expect(urlHelper.getServerApiUrl('https://GitHub.com')).toBe(
|
||||||
'https://api.github.com'
|
'https://api.github.com'
|
||||||
)
|
)
|
||||||
expect(urlHelper.getServerApiUrl('https://contoso.ghe.com')).toBe(
|
expect(urlHelper.getServerApiUrl('https://europe.ghe.com')).toBe(
|
||||||
'https://api.contoso.ghe.com'
|
'https://api.europe.ghe.com'
|
||||||
)
|
)
|
||||||
expect(urlHelper.getServerApiUrl('https://fabrikam.GHE.COM')).toBe(
|
expect(urlHelper.getServerApiUrl('https://australia.GHE.COM')).toBe(
|
||||||
'https://api.fabrikam.ghe.com'
|
'https://api.australia.ghe.com'
|
||||||
)
|
)
|
||||||
expect(
|
expect(
|
||||||
urlHelper.getServerApiUrl('https://src.onpremise.fabrikam.com')
|
urlHelper.getServerApiUrl('https://src.onpremise.customer.com')
|
||||||
).toBe('https://src.onpremise.fabrikam.com/api/v3')
|
).toBe('https://src.onpremise.customer.com/api/v3')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -2477,9 +2477,9 @@ function isGhes(url) {
|
|||||||
const ghUrl = new url_1.URL(url || process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
const ghUrl = new url_1.URL(url || process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
const isGitHubHost = hostname === 'GITHUB.COM';
|
const isGitHubHost = hostname === 'GITHUB.COM';
|
||||||
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
|
const isGheHost = hostname.endsWith('.GHE.COM');
|
||||||
const isLocalHost = hostname.endsWith('.LOCALHOST');
|
const isLocalHost = hostname.endsWith('.LOCALHOST');
|
||||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
return !isGitHubHost && !isGheHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
function pruneSuffix(text, suffix) {
|
function pruneSuffix(text, suffix) {
|
||||||
if (hasContent(suffix, true) && (text === null || text === void 0 ? void 0 : text.endsWith(suffix))) {
|
if (hasContent(suffix, true) && (text === null || text === void 0 ? void 0 : text.endsWith(suffix))) {
|
||||||
|
@ -51,10 +51,10 @@ export function isGhes(url?: string): boolean {
|
|||||||
|
|
||||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||||
const isGitHubHost = hostname === 'GITHUB.COM'
|
const isGitHubHost = hostname === 'GITHUB.COM'
|
||||||
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM')
|
const isGheHost = hostname.endsWith('.GHE.COM')
|
||||||
const isLocalHost = hostname.endsWith('.LOCALHOST')
|
const isLocalHost = hostname.endsWith('.LOCALHOST')
|
||||||
|
|
||||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost
|
return !isGitHubHost && !isGheHost && !isLocalHost
|
||||||
}
|
}
|
||||||
|
|
||||||
function pruneSuffix(text: string, suffix: string) {
|
function pruneSuffix(text: string, suffix: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user