@@ -71138,14 +71138,12 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
7113871138const fs_1 = __importDefault(__nccwpck_require__(7147));
7113971139const constants_1 = __nccwpck_require__(9042);
7114071140const cache_utils_1 = __nccwpck_require__(1678);
71141- const util_1 = __nccwpck_require__(2629);
7114271141const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
7114371142 const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
7114471143 if (!packageManagerInfo) {
7114571144 throw new Error(`Caching for '${packageManager}' is not supported`);
7114671145 }
7114771146 const platform = process.env.RUNNER_OS;
71148- const nodeVersion = util_1.resolveVersionInput();
7114971147 const cachePaths = yield cache_utils_1.getCacheDirectories(packageManagerInfo, cacheDependencyPath);
7115071148 core.saveState(constants_1.State.CachePaths, cachePaths);
7115171149 const lockFilePath = cacheDependencyPath
@@ -71155,7 +71153,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
7115571153 if (!fileHash) {
7115671154 throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
7115771155 }
71158- const keyPrefix = `node-cache-${platform}-${packageManager}-v2-${nodeVersion} `;
71156+ const keyPrefix = `node-cache-${platform}-${packageManager}`;
7115971157 const primaryKey = `${keyPrefix}-${fileHash}`;
7116071158 core.debug(`primary key is ${primaryKey}`);
7116171159 core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
@@ -71366,7 +71364,7 @@ const getCacheDirectories = (packageManagerInfo, cacheDependencyPath) => __await
7136671364});
7136771365exports.getCacheDirectories = getCacheDirectories;
7136871366/**
71369- * Utility function check if the directory is a yarn project configured to manage
71367+ * A function to check if the directory is a yarn project configured to manage
7137071368 * obsolete dependencies in the local cache
7137171369 * @param directory - a path to the folder
7137271370 * @return - true if the directory's project is yarn managed
@@ -71387,18 +71385,11 @@ const isCacheManagedByYarn3 = (directory) => __awaiter(void 0, void 0, void 0, f
7138771385 return enableGlobalCache === 'false';
7138871386});
7138971387/**
71390- * Memoization to avoid expensive walking through the directories tree
71391- */
71392- let hasYarn3ManagedCacheMemoized = null;
71393- /**
71394- * Main function to report either the repo contains at least one Yarn managed directory
71388+ * A function to report either the repo contains at least one Yarn managed directory
7139571389 * @param packageManagerInfo - used to make sure current package manager is yarn
71396- * @return - true if there's at least one Yarn managed directory in the report
71390+ * @return - true if there's at least one Yarn managed directory in the repo
7139771391 */
7139871392const repoHasYarn3ManagedCache = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
71399- if (hasYarn3ManagedCacheMemoized !== null)
71400- return hasYarn3ManagedCacheMemoized;
71401- hasYarn3ManagedCacheMemoized = false;
7140271393 if (packageManagerInfo.name !== 'yarn')
7140371394 return false;
7140471395 const cacheDependencyPath = core.getInput('cache-dependency-path');
@@ -71407,11 +71398,10 @@ const repoHasYarn3ManagedCache = (packageManagerInfo) => __awaiter(void 0, void
7140771398 : [''];
7140871399 for (const dir of yarnDirs.length === 0 ? [''] : yarnDirs) {
7140971400 if (yield isCacheManagedByYarn3(dir)) {
71410- hasYarn3ManagedCacheMemoized = true;
71411- break;
71401+ return true;
7141271402 }
7141371403 }
71414- return hasYarn3ManagedCacheMemoized ;
71404+ return false ;
7141571405});
7141671406exports.repoHasYarn3ManagedCache = repoHasYarn3ManagedCache;
7141771407function isGhes() {
@@ -72171,6 +72161,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7217172161Object.defineProperty(exports, "__esModule", ({ value: true }));
7217272162exports.run = void 0;
7217372163const core = __importStar(__nccwpck_require__(2186));
72164+ const fs_1 = __importDefault(__nccwpck_require__(7147));
7217472165const os_1 = __importDefault(__nccwpck_require__(2037));
7217572166const auth = __importStar(__nccwpck_require__(7573));
7217672167const path = __importStar(__nccwpck_require__(1017));
@@ -72185,7 +72176,7 @@ function run() {
7218572176 // Version is optional. If supplied, install / use from the tool cache
7218672177 // If not supplied then task is still used to setup proxy, auth, etc...
7218772178 //
72188- const version = util_1. resolveVersionInput();
72179+ const version = resolveVersionInput();
7218972180 let arch = core.getInput('architecture');
7219072181 const cache = core.getInput('cache');
7219172182 // if architecture supplied but node-version is not
@@ -72232,6 +72223,25 @@ function run() {
7223272223 });
7223372224}
7223472225exports.run = run;
72226+ function resolveVersionInput() {
72227+ let version = core.getInput('node-version');
72228+ const versionFileInput = core.getInput('node-version-file');
72229+ if (version && versionFileInput) {
72230+ core.warning('Both node-version and node-version-file inputs are specified, only node-version will be used');
72231+ }
72232+ if (version) {
72233+ return version;
72234+ }
72235+ if (versionFileInput) {
72236+ const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput);
72237+ if (!fs_1.default.existsSync(versionFilePath)) {
72238+ throw new Error(`The specified node version file at: ${versionFilePath} does not exist`);
72239+ }
72240+ version = util_1.parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8'));
72241+ core.info(`Resolved ${versionFileInput} as ${version}`);
72242+ }
72243+ return version;
72244+ }
7223572245
7223672246
7223772247/***/ }),
@@ -72269,15 +72279,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7226972279 step((generator = generator.apply(thisArg, _arguments || [])).next());
7227072280 });
7227172281};
72272- var __importDefault = (this && this.__importDefault) || function (mod) {
72273- return (mod && mod.__esModule) ? mod : { "default": mod };
72274- };
7227572282Object.defineProperty(exports, "__esModule", ({ value: true }));
72276- exports.resolveVersionInput = exports. unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
72283+ exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
7227772284const core = __importStar(__nccwpck_require__(2186));
7227872285const exec = __importStar(__nccwpck_require__(1514));
72279- const path_1 = __importDefault(__nccwpck_require__(1017));
72280- const fs_1 = __importDefault(__nccwpck_require__(7147));
7228172286function parseNodeVersionFile(contents) {
7228272287 var _a, _b, _c;
7228372288 let nodeVersion;
@@ -72347,26 +72352,6 @@ const unique = () => {
7234772352 };
7234872353};
7234972354exports.unique = unique;
72350- function resolveVersionInput() {
72351- let version = core.getInput('node-version');
72352- const versionFileInput = core.getInput('node-version-file');
72353- if (version && versionFileInput) {
72354- core.warning('Both node-version and node-version-file inputs are specified, only node-version will be used');
72355- }
72356- if (version) {
72357- return version;
72358- }
72359- if (versionFileInput) {
72360- const versionFilePath = path_1.default.join(process.env.GITHUB_WORKSPACE, versionFileInput);
72361- if (!fs_1.default.existsSync(versionFilePath)) {
72362- throw new Error(`The specified node version file at: ${versionFilePath} does not exist`);
72363- }
72364- version = parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8'));
72365- core.info(`Resolved ${versionFileInput} as ${version}`);
72366- }
72367- return version;
72368- }
72369- exports.resolveVersionInput = resolveVersionInput;
7237072355
7237172356
7237272357/***/ }),
0 commit comments