mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-23 17:23:59 +08:00
Strict restore implemented
This commit is contained in:
parent
dde24d199d
commit
7924423105
3 changed files with 12 additions and 1 deletions
|
@ -2,7 +2,8 @@ export enum Inputs {
|
|||
Key = "key",
|
||||
Path = "path",
|
||||
RestoreKeys = "restore-keys",
|
||||
UploadChunkSize = "upload-chunk-size"
|
||||
UploadChunkSize = "upload-chunk-size",
|
||||
StrictRestore = "strict-restore"
|
||||
}
|
||||
|
||||
export enum Outputs {
|
||||
|
|
|
@ -51,6 +51,13 @@ async function run(): Promise<void> {
|
|||
|
||||
const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
|
||||
utils.setCacheHitOutput(isExactKeyMatch);
|
||||
|
||||
if (!isExactKeyMatch && core.getInput(Inputs.StrictRestore) == "true") {
|
||||
core.info(
|
||||
"Cache with exact key not found, hence exiting the workflow as strict-restore is set to true"
|
||||
);
|
||||
return;
|
||||
}
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
} catch (error: unknown) {
|
||||
core.setFailed((error as Error).message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue