@ -3689,9 +3689,9 @@ const installer = __importStar(__webpack_require__(923));
const semver = _ _importStar ( _ _webpack _require _ _ ( 280 ) ) ;
const path _1 = _ _importDefault ( _ _webpack _require _ _ ( 622 ) ) ;
const cache _restore _1 = _ _webpack _require _ _ ( 409 ) ;
const cache _utils _1 = _ _webpack _require _ _ ( 143 ) ;
const child _process _1 = _ _importDefault ( _ _webpack _require _ _ ( 129 ) ) ;
const fs _1 = _ _importDefault ( _ _webpack _require _ _ ( 747 ) ) ;
const url _1 = _ _webpack _require _ _ ( 835 ) ;
function run ( ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
try {
@ -3700,11 +3700,11 @@ function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
let versionSpec = core . getInput ( 'go-version' ) ;
const cache = core . get Input( 'cache' ) ;
const cache = core . get Boolean Input( 'cache' ) ;
core . info ( ` Setup go version spec ${ versionSpec } ` ) ;
if ( versionSpec ) {
let token = core . getInput ( 'token' ) ;
let auth = ! token || isGhes( ) ? undefined : ` token ${ token } ` ;
let auth = ! token || cache_utils _1 . isGhes( ) ? undefined : ` token ${ token } ` ;
const checkLatest = core . getBooleanInput ( 'check-latest' ) ;
const installDir = yield installer . getGo ( versionSpec , checkLatest , auth ) ;
core . addPath ( path _1 . default . join ( installDir , 'bin' ) ) ;
@ -3719,11 +3719,8 @@ function run() {
core . debug ( ` add bin ${ added } ` ) ;
core . info ( ` Successfully setup go version ${ versionSpec } ` ) ;
}
if ( cache ) {
if ( isGhes ( ) ) {
throw new Error ( 'Caching is not supported on GHES' ) ;
}
const packageManager = cache . toUpperCase ( ) === 'TRUE' ? 'default' : cache ;
if ( cache && cache _utils _1 . isCacheFeatureAvailable ( ) ) {
const packageManager = 'default' ;
const cacheDependencyPath = core . getInput ( 'cache-dependency-path' ) ;
yield cache _restore _1 . restoreCache ( packageManager , cacheDependencyPath ) ;
}
@ -3775,10 +3772,6 @@ function addBinToPath() {
} ) ;
}
exports . addBinToPath = addBinToPath ;
function isGhes ( ) {
const ghUrl = new url _1 . URL ( process . env [ 'GITHUB_SERVER_URL' ] || 'https://github.com' ) ;
return ghUrl . hostname . toUpperCase ( ) !== 'GITHUB.COM' ;
}
/***/ } ) ,
@ -4171,7 +4164,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
} ) ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
exports . getCacheDirectoryPath = exports . getPackageManagerInfo = exports . getCommandOutput = void 0 ;
exports . isCacheFeatureAvailable = exports . isGhes = exports . getCacheDirectoryPath = exports . getPackageManagerInfo = exports . getCommandOutput = void 0 ;
const cache = _ _importStar ( _ _webpack _require _ _ ( 692 ) ) ;
const core = _ _importStar ( _ _webpack _require _ _ ( 470 ) ) ;
const exec = _ _importStar ( _ _webpack _require _ _ ( 986 ) ) ;
const package _managers _1 = _ _webpack _require _ _ ( 813 ) ;
exports . getCommandOutput = ( toolCommand ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
@ -4198,6 +4193,24 @@ exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0
}
return stdout ;
} ) ;
function isGhes ( ) {
const ghUrl = new URL ( process . env [ 'GITHUB_SERVER_URL' ] || 'https://github.com' ) ;
return ghUrl . hostname . toUpperCase ( ) !== 'GITHUB.COM' ;
}
exports . isGhes = isGhes ;
function isCacheFeatureAvailable ( ) {
if ( ! cache . isFeatureAvailable ( ) ) {
if ( isGhes ( ) ) {
throw new Error ( 'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.' ) ;
}
else {
core . warning ( 'The runner was not able to contact the cache service. Caching will be skipped' ) ;
}
return false ;
}
return true ;
}
exports . isCacheFeatureAvailable = isCacheFeatureAvailable ;
/***/ } ) ,
@ -34244,6 +34257,7 @@ const cache_utils_1 = __webpack_require__(143);
exports . restoreCache = ( packageManager , cacheDependencyPath ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
const packageManagerInfo = yield cache _utils _1 . getPackageManagerInfo ( packageManager ) ;
const platform = process . env . RUNNER _OS ;
const versionSpec = core . getInput ( 'go-version' ) ;
const cachePath = yield cache _utils _1 . getCacheDirectoryPath ( packageManagerInfo ) ;
const dependencyFilePath = cacheDependencyPath
? cacheDependencyPath
@ -34252,7 +34266,7 @@ exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0
if ( ! fileHash ) {
throw new Error ( 'Some specified paths were not resolved, unable to cache dependencies.' ) ;
}
const primaryKey = ` go-cache- ${ platform } - ${ fileHash } ` ;
const primaryKey = ` ${ platform } -go ${ versionSpec } - ${ fileHash } ` ;
core . debug ( ` primary key is ${ primaryKey } ` ) ;
core . saveState ( constants _1 . State . CachePrimaryKey , primaryKey ) ;
const cacheKey = yield cache . restoreCache ( [ cachePath ] , primaryKey ) ;