File tree Expand file tree Collapse file tree 2 files changed +4
-27
lines changed Expand file tree Collapse file tree 2 files changed +4
-27
lines changed Original file line number Diff line number Diff line change @@ -85,28 +85,6 @@ describe('apiURL', () => {
85
85
} ) ;
86
86
} ) ;
87
87
88
- describe ( 'isGHES' , ( ) => {
89
- afterEach ( ( ) => {
90
- process . env . GITHUB_SERVER_URL = '' ;
91
- } ) ;
92
- it ( 'should return false when the request domain is github.com' , ( ) => {
93
- process . env . GITHUB_SERVER_URL = 'https://github.com' ;
94
- expect ( GitHub . isGHES ) . toBe ( false ) ;
95
- } ) ;
96
- it ( 'should return false when the request domain ends with ghe.com' , ( ) => {
97
- process . env . GITHUB_SERVER_URL = 'https://my.domain.ghe.com' ;
98
- expect ( GitHub . isGHES ) . toBe ( false ) ;
99
- } ) ;
100
- it ( 'should return false when the request domain ends with ghe.localhost' , ( ) => {
101
- process . env . GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost' ;
102
- expect ( GitHub . isGHES ) . toBe ( false ) ;
103
- } ) ;
104
- it ( 'should return true when the request domain is specific to an enterprise' , ( ) => {
105
- process . env . GITHUB_SERVER_URL = 'https://my-enterprise.github.com' ;
106
- expect ( GitHub . isGHES ) . toBe ( true ) ;
107
- } ) ;
108
- } ) ;
109
-
110
88
describe ( 'repository' , ( ) => {
111
89
it ( 'returns GitHub repository' , async ( ) => {
112
90
expect ( GitHub . repository ) . toEqual ( 'docker/actions-toolkit' ) ;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import os from 'os';
22
22
import path from 'path' ;
23
23
import { CreateArtifactRequest , FinalizeArtifactRequest , StringValue } from '@actions/artifact/lib/generated' ;
24
24
import { internalArtifactTwirpClient } from '@actions/artifact/lib/internal/shared/artifact-twirp-client' ;
25
+ import { isGhes } from '@actions/artifact/lib/internal/shared/config' ;
25
26
import { getBackendIdsFromToken } from '@actions/artifact/lib/internal/shared/util' ;
26
27
import { getExpiration } from '@actions/artifact/lib/internal/upload/retention' ;
27
28
import { InvalidResponseError , NetworkError } from '@actions/artifact' ;
@@ -67,11 +68,9 @@ export class GitHub {
67
68
}
68
69
69
70
static get isGHES ( ) : boolean {
70
- const serverURL = new URL ( GitHub . serverURL ) ;
71
- const hostname = serverURL . hostname . trimEnd ( ) . toUpperCase ( ) ;
72
- const isGitHubHost = hostname === 'GITHUB.COM' ;
73
- const isGHESHost = hostname . endsWith ( '.GHE.COM' ) || hostname . endsWith ( '.GHE.LOCALHOST' ) ;
74
- return ! isGitHubHost && ! isGHESHost ;
71
+ // FIXME: we are using the function from GitHub artifact module but should
72
+ // be within core module when available.
73
+ return isGhes ( ) ;
75
74
}
76
75
77
76
static get repository ( ) : string {
You can’t perform that action at this time.
0 commit comments