mirror of https://github.com/actions/toolkit
updating allowed hosts to include ghe.com
parent
1a1d5e3792
commit
79886daf63
|
@ -13,12 +13,12 @@ describe('isGhes', () => {
|
|||
})
|
||||
|
||||
it('should return false when the request domain ends with ghe.com', () => {
|
||||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com'
|
||||
process.env.GITHUB_SERVER_URL = 'https://github.ghe.com'
|
||||
expect(config.isGhes()).toBe(false)
|
||||
})
|
||||
|
||||
it('should return false when the request domain ends with ghe.localhost', () => {
|
||||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
|
||||
process.env.GITHUB_SERVER_URL = 'https://github.ghe.localhost'
|
||||
expect(config.isGhes()).toBe(false)
|
||||
})
|
||||
|
||||
|
|
|
@ -28,11 +28,15 @@ export function isGhes(): boolean {
|
|||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
)
|
||||
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||
const isGitHubHost = (hostname == 'GITHUB.COM')
|
||||
const isProximaHost = (hostname.endsWith('GHE.COM') || hostname.endsWith('GHE.LOCALHOST'))
|
||||
let githubHosts = [
|
||||
'GITHUB.COM',
|
||||
'GITHUB.GHE.COM',
|
||||
'GITHUB.GHE.LOCALHOST'
|
||||
];
|
||||
|
||||
return !isGitHubHost && !isProximaHost
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||
|
||||
return !githubHosts.includes(hostname)
|
||||
}
|
||||
|
||||
export function getGitHubWorkspaceDir(): string {
|
||||
|
|
|
@ -49,7 +49,7 @@ test('isGhes returns false for github.com', async () => {
|
|||
})
|
||||
|
||||
test('isGhes returns false for ghe.com', async () => {
|
||||
process.env.GITHUB_SERVER_URL = 'https://somedomain.ghe.com'
|
||||
process.env.GITHUB_SERVER_URL = 'https://github.ghe.com'
|
||||
expect(cacheUtils.isGhes()).toBe(false)
|
||||
})
|
||||
|
||||
|
@ -59,6 +59,6 @@ test('isGhes returns true for enterprise URL', async () => {
|
|||
})
|
||||
|
||||
test('isGhes returns false for ghe.localhost', () => {
|
||||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
|
||||
process.env.GITHUB_SERVER_URL = 'https://github.ghe.localhost'
|
||||
expect(cacheUtils.isGhes()).toBe(false)
|
||||
})
|
|
@ -136,9 +136,13 @@ export function isGhes(): boolean {
|
|||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
)
|
||||
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||
const isGitHubHost = (hostname == 'GITHUB.COM')
|
||||
const isProximaHost = (hostname.endsWith('GHE.COM') || hostname.endsWith('GHE.LOCALHOST'))
|
||||
let githubHosts = [
|
||||
'GITHUB.COM',
|
||||
'GITHUB.GHE.COM',
|
||||
'GITHUB.GHE.LOCALHOST'
|
||||
];
|
||||
|
||||
return !isGitHubHost && !isProximaHost
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||
|
||||
return !githubHosts.includes(hostname)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue