MCPcopy
hub / github.com/actions/setup-java / restore

Function restore

src/cache.ts:112–128  ·  view source on GitHub ↗
(id: string, cacheDependencyPath: string)

Source from the content-addressed store, hash-verified

110 * @param cacheDependencyPath The path to a dependency file
111 */
112export 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

Callers 2

runFunction · 0.90
cache.test.tsFile · 0.90

Calls 2

findPackageManagerFunction · 0.85
computeCacheKeyFunction · 0.85

Tested by

no test coverage detected