Changes after rebase

This commit is contained in:
Marc Mueller 2023-01-08 12:10:17 +01:00
parent 1bb6d2503c
commit e614c5820d
7 changed files with 16 additions and 13 deletions

View file

@ -232,7 +232,7 @@ test("restore with dry-run set", async () => {
testUtils.setInputs({
path: path,
key,
dryRun: "true"
dryRun: true
});
const infoMock = jest.spyOn(core, "info");

View file

@ -11,10 +11,6 @@ inputs:
restore-keys:
description: 'An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.'
required: false
dry-run:
description: 'Skip downloading cache. Only check if cache entry exists'
required: false
default: "false"
upload-chunk-size:
description: 'The chunk size used to split up large files during upload, in bytes'
required: false
@ -22,6 +18,10 @@ 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:
description: 'Skip downloading cache. Only check if cache entry exists'
default: 'false'
required: false
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'

View file

@ -50505,7 +50505,8 @@ function restoreImpl(stateProvider) {
required: true
});
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: core.getBooleanInput(constants_1.Inputs.DryRun) }, enableCrossOsArchive);
const dryRun = utils.getInputAsBool(constants_1.Inputs.DryRun);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: dryRun }, enableCrossOsArchive);
if (!cacheKey) {
core.info(`Cache not found for input keys: ${[
primaryKey,

View file

@ -50505,7 +50505,8 @@ function restoreImpl(stateProvider) {
required: true
});
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: core.getBooleanInput(constants_1.Inputs.DryRun) }, enableCrossOsArchive);
const dryRun = utils.getInputAsBool(constants_1.Inputs.DryRun);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { dryRun: dryRun }, enableCrossOsArchive);
if (!cacheKey) {
core.info(`Cache not found for input keys: ${[
primaryKey,

View file

@ -17,8 +17,8 @@ inputs:
required: false
dry-run:
description: 'Skip downloading cache. Only check if cache entry exists'
default: 'false'
required: false
default: "false"
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'

View file

@ -34,12 +34,13 @@ async function restoreImpl(
const enableCrossOsArchive = utils.getInputAsBool(
Inputs.EnableCrossOsArchive
);
const dryRun = utils.getInputAsBool(Inputs.DryRun);
const cacheKey = await cache.restoreCache(
cachePaths,
primaryKey,
restoreKeys,
{ dryRun: core.getBooleanInput(Inputs.DryRun) },
{ dryRun: dryRun },
enableCrossOsArchive
);

View file

@ -14,13 +14,12 @@ interface CacheInput {
key: string;
restoreKeys?: string[];
enableCrossOsArchive?: boolean;
dryRun?: string;
dryRun?: boolean;
}
export function setInputs(input: CacheInput): void {
setInput(Inputs.Path, input.path);
setInput(Inputs.Key, input.key);
setInput(Inputs.DryRun, "false");
input.restoreKeys &&
setInput(Inputs.RestoreKeys, input.restoreKeys.join("\n"));
input.enableCrossOsArchive !== undefined &&
@ -28,14 +27,15 @@ export function setInputs(input: CacheInput): void {
Inputs.EnableCrossOsArchive,
input.enableCrossOsArchive.toString()
);
input.dryRun && setInput(Inputs.DryRun, input.dryRun);
input.dryRun !== undefined &&
setInput(Inputs.DryRun, input.dryRun.toString());
}
export function clearInputs(): void {
delete process.env[getInputName(Inputs.Path)];
delete process.env[getInputName(Inputs.Key)];
delete process.env[getInputName(Inputs.RestoreKeys)];
delete process.env[getInputName(Inputs.DryRun)];
delete process.env[getInputName(Inputs.UploadChunkSize)];
delete process.env[getInputName(Inputs.EnableCrossOsArchive)];
delete process.env[getInputName(Inputs.DryRun)];
}