1
0
Fork 0

allow localhost hostnames for artifact checks

pull/1768/head
Rob Herley 2024-07-03 16:55:53 +00:00 committed by GitHub
parent 361a115e53
commit 176b40a888
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# @actions/artifact Releases # @actions/artifact Releases
### 2.1.8
- Allows `*.localhost` domains for hostname checks for local development.
### 2.1.7 ### 2.1.7
- Update unzip-stream dependency and reverted to using `unzip.Extract()` - Update unzip-stream dependency and reverted to using `unzip.Extract()`

View File

@ -20,6 +20,11 @@ describe('isGhes', () => {
expect(config.isGhes()).toBe(false) expect(config.isGhes()).toBe(false)
}) })
it('should return false when the request domain ends with .localhost', () => {
process.env.GITHUB_SERVER_URL = 'https://github.localhost'
expect(config.isGhes()).toBe(false)
})
it('should return false when the request domain is specific to an enterprise', () => { it('should return false when the request domain is specific to an enterprise', () => {
process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com' process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com'
expect(config.isGhes()).toBe(true) expect(config.isGhes()).toBe(true)

View File

@ -1,6 +1,6 @@
{ {
"name": "@actions/artifact", "name": "@actions/artifact",
"version": "2.1.7", "version": "2.1.8",
"preview": true, "preview": true,
"description": "Actions artifact lib", "description": "Actions artifact lib",
"keywords": [ "keywords": [

View File

@ -30,10 +30,10 @@ export function isGhes(): boolean {
const hostname = ghUrl.hostname.trimEnd().toUpperCase() const hostname = ghUrl.hostname.trimEnd().toUpperCase()
const isGitHubHost = hostname === 'GITHUB.COM' const isGitHubHost = hostname === 'GITHUB.COM'
const isGheHost = const isGheHost = hostname.endsWith('.GHE.COM')
hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST') const isLocalHost = hostname.endsWith('.LOCALHOST')
return !isGitHubHost && !isGheHost return !isGitHubHost && !isGheHost && !isLocalHost
} }
export function getGitHubWorkspaceDir(): string { export function getGitHubWorkspaceDir(): string {