@actions/cache
Advanced tools
Comparing version 2.0.6 to 3.0.0
@@ -86,13 +86,14 @@ "use strict"; | ||
const compressionMethod = yield utils.getCompressionMethod(); | ||
// path are needed to compute version | ||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, { | ||
compressionMethod | ||
}); | ||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) { | ||
// Cache not found | ||
return undefined; | ||
} | ||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); | ||
core.debug(`Archive Path: ${archivePath}`); | ||
let archivePath = ''; | ||
try { | ||
// path are needed to compute version | ||
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, { | ||
compressionMethod | ||
}); | ||
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) { | ||
// Cache not found | ||
return undefined; | ||
} | ||
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); | ||
core.debug(`Archive Path: ${archivePath}`); | ||
// Download the cache from the cache entry | ||
@@ -107,3 +108,14 @@ yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); | ||
core.info('Cache restored successfully'); | ||
return cacheEntry.cacheKey; | ||
} | ||
catch (error) { | ||
const typedError = error; | ||
if (typedError.name === ValidationError.name) { | ||
throw error; | ||
} | ||
else { | ||
// Supress all non-validation cache related errors because caching should be optional | ||
core.warning(`Failed to restore: ${error.message}`); | ||
} | ||
} | ||
finally { | ||
@@ -118,3 +130,3 @@ // Try to delete the archive to save space | ||
} | ||
return cacheEntry.cacheKey; | ||
return undefined; | ||
}); | ||
@@ -137,3 +149,3 @@ } | ||
const compressionMethod = yield utils.getCompressionMethod(); | ||
let cacheId = null; | ||
let cacheId = -1; | ||
const cachePaths = yield utils.resolvePaths(paths); | ||
@@ -177,2 +189,14 @@ core.debug('Cache Paths:'); | ||
} | ||
catch (error) { | ||
const typedError = error; | ||
if (typedError.name === ValidationError.name) { | ||
throw error; | ||
} | ||
else if (typedError.name === ReserveCacheError.name) { | ||
core.info(`Failed to save: ${typedError.message}`); | ||
} | ||
else { | ||
core.warning(`Failed to save: ${typedError.message}`); | ||
} | ||
} | ||
finally { | ||
@@ -179,0 +203,0 @@ // Try to delete the archive to save space |
{ | ||
"name": "@actions/cache", | ||
"version": "2.0.6", | ||
"version": "3.0.0", | ||
"preview": true, | ||
@@ -5,0 +5,0 @@ "description": "Actions cache lib", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95259
1400