Skip to content

Commit

Permalink
Move isGhes utility to core file
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolai-laevskii committed Oct 4, 2023
1 parent 31b2794 commit 44ffc8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
13 changes: 8 additions & 5 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ export async function getIDToken(aud?: string): Promise<string> {
return await OidcClient.getIDToken(aud)
}

/**
* Returns whether action runs on GitHub Enterprise Server or not.
*/
export function isGhes(): boolean {
const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'
return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'
}

/**
* Summary exports
*/
Expand All @@ -386,8 +394,3 @@ export {markdownSummary} from './summary'
* Path exports
*/
export {toPosixPath, toWin32Path, toPlatformPath} from './path-utils'

/**
* isGhes helper export
*/
export {isGhes} from './utils'
8 changes: 0 additions & 8 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,3 @@ export function toCommandProperties(
endColumn: annotationProperties.endColumn
}
}

/**
* Returns this action runs on GitHub Enterprise Server or not.
*/
export function isGhes(): boolean {
const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'
return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'
}

0 comments on commit 44ffc8f

Please sign in to comment.