Set default cache input to false for self-hosted runners

This commit is contained in:
Sergey Dolin 2023-08-17 18:16:38 +02:00
parent 93397bea11
commit 8b0dfa3b5d
6 changed files with 102 additions and 19 deletions

40
dist/setup/index.js vendored
View file

@ -61495,8 +61495,7 @@ function cacheWindowsDir(extPath, tool, version, arch) {
if (os_1.default.platform() !== 'win32')
return false;
// make sure the action runs in the hosted environment
if (process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
process.env['AGENT_ISSELFHOSTED'] === '1')
if (utils_1.isSelfHosted())
return false;
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'];
if (!defaultToolCacheRoot)
@ -61777,6 +61776,7 @@ const cache_utils_1 = __nccwpck_require__(1678);
const child_process_1 = __importDefault(__nccwpck_require__(2081));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const os_1 = __importDefault(__nccwpck_require__(2037));
const utils_1 = __nccwpck_require__(1314);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
@ -61785,7 +61785,7 @@ function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
const versionSpec = resolveVersionInput();
const cache = core.getBooleanInput('cache');
const cache = utils_1.getCacheInput();
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture');
if (!arch) {
@ -61966,17 +61966,47 @@ exports.getArch = getArch;
/***/ }),
/***/ 1314:
/***/ ((__unused_webpack_module, exports) => {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.StableReleaseAlias = void 0;
exports.getCacheInput = exports.isSelfHosted = exports.StableReleaseAlias = void 0;
const core = __importStar(__nccwpck_require__(2186));
var StableReleaseAlias;
(function (StableReleaseAlias) {
StableReleaseAlias["Stable"] = "stable";
StableReleaseAlias["OldStable"] = "oldstable";
})(StableReleaseAlias = exports.StableReleaseAlias || (exports.StableReleaseAlias = {}));
const isSelfHosted = () => process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
process.env['AGENT_ISSELFHOSTED'] === '1';
exports.isSelfHosted = isSelfHosted;
const getCacheInput = () => {
// for self-hosted environment turn off cache by default
if (exports.isSelfHosted() && core.getInput('cache') === '')
return false;
return core.getBooleanInput('cache');
};
exports.getCacheInput = getCacheInput;
/***/ }),