(id: string, cacheDependencyPath: string)
| 110 | * @param cacheDependencyPath The path to a dependency file |
| 111 | */ |
| 112 | export async function restore(id: string, cacheDependencyPath: string) { |
| 113 | const packageManager = findPackageManager(id); |
| 114 | const primaryKey = await computeCacheKey(packageManager, cacheDependencyPath); |
| 115 | core.debug(`primary key is ${primaryKey}`); |
| 116 | core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey); |
| 117 | |
| 118 | // No "restoreKeys" is set, to start with a clear cache after dependency update (see https://github.com/actions/setup-java/issues/269) |
| 119 | const matchedKey = await cache.restoreCache(packageManager.path, primaryKey); |
| 120 | if (matchedKey) { |
| 121 | core.saveState(CACHE_MATCHED_KEY, matchedKey); |
| 122 | core.setOutput('cache-hit', matchedKey === primaryKey); |
| 123 | core.info(`Cache restored from key: ${matchedKey}`); |
| 124 | } else { |
| 125 | core.setOutput('cache-hit', false); |
| 126 | core.info(`${packageManager.id} cache is not found`); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Save the dependency cache |
no test coverage detected