mirror of
https://github.com/actions/setup-java.git
synced 2025-04-22 10:56:45 +00:00
feat(cache): change key to match actions/cache documentation
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
This commit is contained in:
parent
3bc31aaf88
commit
0f6dbb0a05
7 changed files with 39 additions and 25 deletions
12
dist/cleanup/index.js
vendored
12
dist/cleanup/index.js
vendored
|
@ -64575,7 +64575,7 @@ function findPackageManager(id) {
|
|||
function computeCacheKey(packageManager) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const hash = yield glob.hashFiles(packageManager.pattern.join('\n'));
|
||||
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${packageManager.id}-${hash}`;
|
||||
return `${process.env.RUNNER_OS}-${CACHE_KEY_PREFIX}-${packageManager.id}-${hash}`;
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -64591,15 +64591,17 @@ function restore(id) {
|
|||
if (primaryKey.endsWith('-')) {
|
||||
throw new Error(`No file in ${process.cwd()} matched to [${packageManager.pattern}], make sure you have checked out the target repository`);
|
||||
}
|
||||
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, [
|
||||
`${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${id}`
|
||||
]);
|
||||
const restoreKeys = [
|
||||
`${process.env.RUNNER_OS}-${CACHE_KEY_PREFIX}-${id}-`,
|
||||
`${process.env.RUNNER_OS}-${CACHE_KEY_PREFIX}-`
|
||||
];
|
||||
const matchedKey = yield cache.restoreCache(packageManager.path, primaryKey, restoreKeys);
|
||||
if (matchedKey) {
|
||||
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`Cache restored from key: ${matchedKey}`);
|
||||
}
|
||||
else {
|
||||
core.info(`${packageManager.id} cache is not found`);
|
||||
core.info(`Cache not found for input keys: ${[primaryKey, ...restoreKeys].join(', ')}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue