1
0
Fork 0

Add isGhes utility

pull/1546/head
Nikolai Laevskii 2023-08-10 06:17:07 +02:00
parent fe3e7ce9a7
commit ea267efe86
2 changed files with 13 additions and 0 deletions

View File

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

View File

@ -39,3 +39,11 @@ export function toCommandProperties(
endColumn: annotationProperties.endColumn 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'
}