import * as core from '@actions/core' ; const PLATFORMS = [ 'alpine' , 'linux' , 'macos' , 'windows' ] ; const setFailure = ( message , failCi ) : void => { failCi ? core . setFailed ( message ) : core . warning ( message ) ; if ( failCi ) { process . exit ( ) ; } } ; const getUploaderName = ( platform ) : string => { if ( isWindows ( platform ) ) { return 'codecov.exe' ; } else { return 'codecov' ; } } ; const isValidPlatform = ( platform ) : boolean => { return PLATFORMS . includes ( platform ) ; } ; const isWindows = ( platform ) : boolean => { return platform === 'windows' ; } ; const getPlatform = ( os ? ) : string => { if ( isValidPlatform ( os ) ) { core . info ( `==> ${ os } OS provided` ) ; return os ; } const platform = process . env . RUNNER_OS ?. toLowerCase ( ) ; if ( isValidPlatform ( platform ) ) { core . info ( `==> ${ platform } OS detected` ) ; return platform ; } core . info ( '==> Could not detect OS or provided OS is invalid. Defaulting to linux' ) ; return 'linux' ; } ; const getBaseUrl = ( platform , version ) : string => { return `https://uploader.codecov.io/${ version }/${ platform }/${ getUploaderName ( platform ) }` ; } ; export { PLATFORMS , getBaseUrl , getPlatform , getUploaderName , isValidPlatform , isWindows , setFailure , } ;