Add lookup-only option (#1041)

* Add new actions/cache version (with dryRun support)

* Add dry-run option

* Changes after rebase

* Update readme

* Rename option to lookup-only

* Update test name

* Update package.json + changelog

* Update README

* Update custom package version

* Update custom package version

* Update @actions/cache to 3.2.0

* Code review

* Update log statement

* Move test case

---------

Co-authored-by: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com>
This commit is contained in:
Marc Mueller 2023-03-09 13:30:28 +01:00 committed by GitHub
parent e0d62270e2
commit 940f3d7cf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 260 additions and 47 deletions

14
dist/save/index.js vendored
View file

@ -4975,7 +4975,8 @@ var Inputs;
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss"; // Input for cache, restore action
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
@ -41862,7 +41863,8 @@ function getDownloadOptions(copy) {
useAzureSdk: true,
downloadConcurrency: 8,
timeoutInMs: 30000,
segmentTimeoutInMs: 3600000
segmentTimeoutInMs: 3600000,
lookupOnly: false
};
if (copy) {
if (typeof copy.useAzureSdk === 'boolean') {
@ -41877,6 +41879,9 @@ function getDownloadOptions(copy) {
if (typeof copy.segmentTimeoutInMs === 'number') {
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
}
if (typeof copy.lookupOnly === 'boolean') {
result.lookupOnly = copy.lookupOnly;
}
}
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
if (segmentDownloadTimeoutMins &&
@ -41889,6 +41894,7 @@ function getDownloadOptions(copy) {
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
core.debug(`Lookup only: ${result.lookupOnly}`);
return result;
}
exports.getDownloadOptions = getDownloadOptions;
@ -47366,6 +47372,10 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
// Cache not found
return undefined;
}
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
core.info('Lookup only - skipping download');
return cacheEntry.cacheKey;
}
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`);
// Download the cache from the cache entry