Skip to content

Commit 3c6ab3c

Browse files
pass version
1 parent 7c66d28 commit 3c6ab3c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

dist/setup/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7569,7 +7569,7 @@ function run() {
75697569
}
75707570
if (cache) {
75717571
if (!isGhes()) {
7572-
yield cache_restore_1.restoreCache(cache);
7572+
yield cache_restore_1.restoreCache(cache, version);
75737573
}
75747574
else {
75757575
core.info('Caching is not supported on GHES');
@@ -43412,7 +43412,7 @@ const util = __importStar(__webpack_require__(669));
4341243412
const path = __importStar(__webpack_require__(622));
4341343413
const constants_1 = __webpack_require__(694);
4341443414
const cache_1 = __webpack_require__(913);
43415-
exports.restoreCache = (type) => __awaiter(void 0, void 0, void 0, function* () {
43415+
exports.restoreCache = (type, version) => __awaiter(void 0, void 0, void 0, function* () {
4341643416
let tool = 'npm';
4341743417
const lockKey = core.getInput(constants_1.Inputs.Key, { required: true });
4341843418
const currentOs = process.env.RUNNER_OS;
@@ -43421,7 +43421,7 @@ exports.restoreCache = (type) => __awaiter(void 0, void 0, void 0, function* ()
4342143421
const yarnVersion = yield cache_1.getYarnVersion();
4342243422
tool = `yarn${yarnVersion}`;
4342343423
}
43424-
const primaryKey = `${currentOs}-${tool}-${fileHash}`;
43424+
const primaryKey = `${currentOs}-${tool}-${version}-${fileHash}`;
4342543425
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
4342643426
const cachePath = yield cache_1.getDefaultCacheDirectory(tool);
4342743427
core.info(`cachePath is ${cachePath}`);

src/cache-restore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import * as path from 'path';
1010
import {State, LockType, Inputs, Outputs} from './constants';
1111
import {getYarnVersion, getDefaultCacheDirectory} from './cache';
1212

13-
export const restoreCache = async (type: LockType | string) => {
13+
export const restoreCache = async (
14+
type: LockType | string,
15+
version: string
16+
) => {
1417
let tool = 'npm';
1518

1619
const lockKey = core.getInput(Inputs.Key, {required: true});
@@ -22,7 +25,7 @@ export const restoreCache = async (type: LockType | string) => {
2225
tool = `yarn${yarnVersion}`;
2326
}
2427

25-
const primaryKey = `${currentOs}-${tool}-${fileHash}`;
28+
const primaryKey = `${currentOs}-${tool}-${version}-${fileHash}`;
2629
core.saveState(State.CachePrimaryKey, primaryKey);
2730

2831
const cachePath = await getDefaultCacheDirectory(tool);

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export async function run() {
5252

5353
if (cache) {
5454
if (!isGhes()) {
55-
await restoreCache(cache);
55+
await restoreCache(cache, version);
5656
} else {
5757
core.info('Caching is not supported on GHES');
5858
}

0 commit comments

Comments
 (0)