mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-05 03:33:15 +08:00
updating allowed hosts to include ghe.com
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user