mirror of
https://github.com/actions/cache.git
synced 2025-04-01 19:06:35 +00:00
Rename option to lookup-only
This commit is contained in:
parent
d1960e64f9
commit
2ef4e0621f
16 changed files with 68 additions and 68 deletions
|
@ -49,7 +49,7 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir
|
|||
* `key` - An explicit key for restoring and saving the cache. Refer [creating a cache key](#creating-a-cache-key).
|
||||
* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key.
|
||||
* `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: false
|
||||
* `dry-run` - Skip downloading cache. Only check if cache entry exists. Default: false
|
||||
* `lookup-only` - Skip downloading cache. Only check if cache entry exists. Default: false
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ test("restore with no cache found", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -122,7 +122,7 @@ test("restore with restore keys and no cache found", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -164,7 +164,7 @@ test("restore with cache found for key", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -209,7 +209,7 @@ test("restore with cache found for restore key", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -232,7 +232,7 @@ test("restore with dry-run set", async () => {
|
|||
testUtils.setInputs({
|
||||
path: path,
|
||||
key,
|
||||
dryRun: true
|
||||
lookupOnly: true
|
||||
});
|
||||
|
||||
const infoMock = jest.spyOn(core, "info");
|
||||
|
@ -253,7 +253,7 @@ test("restore with dry-run set", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: true
|
||||
lookupOnly: true
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
@ -127,7 +127,7 @@ test("restore on GHES with AC available ", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -181,7 +181,7 @@ test("restore with too many keys should fail", async () => {
|
|||
key,
|
||||
restoreKeys,
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -207,7 +207,7 @@ test("restore with large key should fail", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -233,7 +233,7 @@ test("restore with invalid key should fail", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -268,7 +268,7 @@ test("restore with no cache found", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -309,7 +309,7 @@ test("restore with restore keys and no cache found", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -349,7 +349,7 @@ test("restore with cache found for key", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -391,7 +391,7 @@ test("restore with cache found for restore key", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
@ -80,7 +80,7 @@ test("restore with no cache found", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -122,7 +122,7 @@ test("restore with restore keys and no cache found", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -161,7 +161,7 @@ test("restore with cache found for key", async () => {
|
|||
key,
|
||||
[],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
@ -204,7 +204,7 @@ test("restore with cache found for restore key", async () => {
|
|||
key,
|
||||
[restoreKey],
|
||||
{
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
@ -18,7 +18,7 @@ inputs:
|
|||
description: 'An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms'
|
||||
default: 'false'
|
||||
required: false
|
||||
dry-run:
|
||||
lookup-only:
|
||||
description: 'Skip downloading cache. Only check if cache entry exists'
|
||||
default: 'false'
|
||||
required: false
|
||||
|
|
18
dist/restore-only/index.js
vendored
18
dist/restore-only/index.js
vendored
|
@ -4979,7 +4979,7 @@ var Inputs;
|
|||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||
Inputs["DryRun"] = "dry-run"; // Input for cache, restore action
|
||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
@ -41810,7 +41810,7 @@ function getDownloadOptions(copy) {
|
|||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000,
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
|
@ -41825,8 +41825,8 @@ function getDownloadOptions(copy) {
|
|||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
if (typeof copy.dryRun === 'boolean') {
|
||||
result.dryRun = copy.dryRun;
|
||||
if (typeof copy.lookupOnly === 'boolean') {
|
||||
result.lookupOnly = copy.lookupOnly;
|
||||
}
|
||||
}
|
||||
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
|
||||
|
@ -41840,7 +41840,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(`Dry run: ${result.dryRun}`);
|
||||
core.debug(`Lookup only: ${result.lookupOnly}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
@ -47289,8 +47289,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
|||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.dryRun) {
|
||||
core.info('Dry run - skipping download');
|
||||
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));
|
||||
|
@ -50505,8 +50505,8 @@ function restoreImpl(stateProvider) {
|
|||
required: true
|
||||
});
|
||||
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
|
||||
const dryRun = utils.getInputAsBool(constants_1.Inputs.DryRun);
|
||||
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: dryRun }, enableCrossOsArchive);
|
||||
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
|
||||
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
|
||||
if (!cacheKey) {
|
||||
core.info(`Cache not found for input keys: ${[
|
||||
primaryKey,
|
||||
|
|
18
dist/restore/index.js
vendored
18
dist/restore/index.js
vendored
|
@ -4979,7 +4979,7 @@ var Inputs;
|
|||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||
Inputs["DryRun"] = "dry-run"; // Input for cache, restore action
|
||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
@ -41781,7 +41781,7 @@ function getDownloadOptions(copy) {
|
|||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000,
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
|
@ -41796,8 +41796,8 @@ function getDownloadOptions(copy) {
|
|||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
if (typeof copy.dryRun === 'boolean') {
|
||||
result.dryRun = copy.dryRun;
|
||||
if (typeof copy.lookupOnly === 'boolean') {
|
||||
result.lookupOnly = copy.lookupOnly;
|
||||
}
|
||||
}
|
||||
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
|
||||
|
@ -41811,7 +41811,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(`Dry run: ${result.dryRun}`);
|
||||
core.debug(`Lookup only: ${result.lookupOnly}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
@ -47260,8 +47260,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
|||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.dryRun) {
|
||||
core.info('Dry run - skipping download');
|
||||
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));
|
||||
|
@ -50505,8 +50505,8 @@ function restoreImpl(stateProvider) {
|
|||
required: true
|
||||
});
|
||||
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
|
||||
const dryRun = utils.getInputAsBool(constants_1.Inputs.DryRun);
|
||||
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: dryRun }, enableCrossOsArchive);
|
||||
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
|
||||
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
|
||||
if (!cacheKey) {
|
||||
core.info(`Cache not found for input keys: ${[
|
||||
primaryKey,
|
||||
|
|
14
dist/save-only/index.js
vendored
14
dist/save-only/index.js
vendored
|
@ -5035,7 +5035,7 @@ var Inputs;
|
|||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||
Inputs["DryRun"] = "dry-run"; // Input for cache, restore action
|
||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
@ -41922,7 +41922,7 @@ function getDownloadOptions(copy) {
|
|||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000,
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
|
@ -41937,8 +41937,8 @@ function getDownloadOptions(copy) {
|
|||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
if (typeof copy.dryRun === 'boolean') {
|
||||
result.dryRun = copy.dryRun;
|
||||
if (typeof copy.lookupOnly === 'boolean') {
|
||||
result.lookupOnly = copy.lookupOnly;
|
||||
}
|
||||
}
|
||||
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
|
||||
|
@ -41952,7 +41952,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(`Dry run: ${result.dryRun}`);
|
||||
core.debug(`Lookup only: ${result.lookupOnly}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
@ -47401,8 +47401,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
|||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.dryRun) {
|
||||
core.info('Dry run - skipping download');
|
||||
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));
|
||||
|
|
14
dist/save/index.js
vendored
14
dist/save/index.js
vendored
|
@ -4979,7 +4979,7 @@ var Inputs;
|
|||
Inputs["RestoreKeys"] = "restore-keys";
|
||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||
Inputs["DryRun"] = "dry-run"; // Input for cache, restore action
|
||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
|
@ -41866,7 +41866,7 @@ function getDownloadOptions(copy) {
|
|||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000,
|
||||
dryRun: false
|
||||
lookupOnly: false
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
|
@ -41881,8 +41881,8 @@ function getDownloadOptions(copy) {
|
|||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
if (typeof copy.dryRun === 'boolean') {
|
||||
result.dryRun = copy.dryRun;
|
||||
if (typeof copy.lookupOnly === 'boolean') {
|
||||
result.lookupOnly = copy.lookupOnly;
|
||||
}
|
||||
}
|
||||
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
|
||||
|
@ -41896,7 +41896,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(`Dry run: ${result.dryRun}`);
|
||||
core.debug(`Lookup only: ${result.lookupOnly}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
@ -47374,8 +47374,8 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
|||
// Cache not found
|
||||
return undefined;
|
||||
}
|
||||
if (options === null || options === void 0 ? void 0 : options.dryRun) {
|
||||
core.info('Dry run - skipping download');
|
||||
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));
|
||||
|
|
12
package-lock.json
generated
12
package-lock.json
generated
|
@ -9,7 +9,7 @@
|
|||
"version": "3.2.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
|
||||
"@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.3.tgz",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2"
|
||||
|
@ -36,9 +36,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@actions/cache": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
|
||||
"integrity": "sha512-1vcZXG2jWtEnDWq34byiQmS8tgOKAzFEIiMFPtxigm3vHOW+9FGdA2S+eWsK3NBLIbWd5erCkWgo4M0g6gw1yw==",
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.3.tgz",
|
||||
"integrity": "sha512-MuG08PR5rNlFjrWJPTvs6uzF2W7ddovjFZHd1ivwehn+Epj01v7MIDDfd7ooeXJ104/ksCj0JhEDr2SxvhxxWA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
|
@ -9723,8 +9723,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": {
|
||||
"version": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
|
||||
"integrity": "sha512-1vcZXG2jWtEnDWq34byiQmS8tgOKAzFEIiMFPtxigm3vHOW+9FGdA2S+eWsK3NBLIbWd5erCkWgo4M0g6gw1yw==",
|
||||
"version": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.3.tgz",
|
||||
"integrity": "sha512-MuG08PR5rNlFjrWJPTvs6uzF2W7ddovjFZHd1ivwehn+Epj01v7MIDDfd7ooeXJ104/ksCj0JhEDr2SxvhxxWA==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
|
||||
"@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.3.tgz",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2"
|
||||
|
|
|
@ -7,7 +7,7 @@ The restore action, as the name suggest, restores a cache. It acts similar to th
|
|||
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
|
||||
* `key` - String used while saving cache for restoring the cache
|
||||
* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key.
|
||||
* `dry-run` - Skip downloading cache. Only check if cache entry exists. Default: false
|
||||
* `lookup-only` - Skip downloading cache. Only check if cache entry exists. Default: false
|
||||
|
||||
## Outputs
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ inputs:
|
|||
description: 'An optional boolean when enabled, allows windows runners to restore caches that were saved on other platforms'
|
||||
default: 'false'
|
||||
required: false
|
||||
dry-run:
|
||||
lookup-only:
|
||||
description: 'Skip downloading cache. Only check if cache entry exists'
|
||||
default: 'false'
|
||||
required: false
|
||||
|
|
|
@ -4,7 +4,7 @@ export enum Inputs {
|
|||
RestoreKeys = "restore-keys", // Input for cache, restore action
|
||||
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
|
||||
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
|
||||
DryRun = "dry-run" // Input for cache, restore action
|
||||
LookupOnly = "lookup-only" // Input for cache, restore action
|
||||
}
|
||||
|
||||
export enum Outputs {
|
||||
|
|
|
@ -34,13 +34,13 @@ async function restoreImpl(
|
|||
const enableCrossOsArchive = utils.getInputAsBool(
|
||||
Inputs.EnableCrossOsArchive
|
||||
);
|
||||
const dryRun = utils.getInputAsBool(Inputs.DryRun);
|
||||
const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly);
|
||||
|
||||
const cacheKey = await cache.restoreCache(
|
||||
cachePaths,
|
||||
primaryKey,
|
||||
restoreKeys,
|
||||
{ dryRun: dryRun },
|
||||
{ lookupOnly: lookupOnly },
|
||||
enableCrossOsArchive
|
||||
);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ interface CacheInput {
|
|||
key: string;
|
||||
restoreKeys?: string[];
|
||||
enableCrossOsArchive?: boolean;
|
||||
dryRun?: boolean;
|
||||
lookupOnly?: boolean;
|
||||
}
|
||||
|
||||
export function setInputs(input: CacheInput): void {
|
||||
|
@ -27,8 +27,8 @@ export function setInputs(input: CacheInput): void {
|
|||
Inputs.EnableCrossOsArchive,
|
||||
input.enableCrossOsArchive.toString()
|
||||
);
|
||||
input.dryRun !== undefined &&
|
||||
setInput(Inputs.DryRun, input.dryRun.toString());
|
||||
input.lookupOnly !== undefined &&
|
||||
setInput(Inputs.LookupOnly, input.lookupOnly.toString());
|
||||
}
|
||||
|
||||
export function clearInputs(): void {
|
||||
|
@ -37,5 +37,5 @@ export function clearInputs(): void {
|
|||
delete process.env[getInputName(Inputs.RestoreKeys)];
|
||||
delete process.env[getInputName(Inputs.UploadChunkSize)];
|
||||
delete process.env[getInputName(Inputs.EnableCrossOsArchive)];
|
||||
delete process.env[getInputName(Inputs.DryRun)];
|
||||
delete process.env[getInputName(Inputs.LookupOnly)];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue