Compare commits

...

3 Commits

Author SHA1 Message Date
Timo Rothenpieler
858526aac6
Merge cccc18b26a into 4fe9c4bd54 2022-10-18 13:24:42 +05:30
Timo Rothenpieler
cccc18b26a Re-Build dist 2022-10-07 14:35:38 +02:00
Timo Rothenpieler
2935c2ea27 Add option to re-evaluate cache key during post action 2022-10-07 14:28:32 +02:00
6 changed files with 15 additions and 5 deletions

View File

@ -36,6 +36,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in
* `key` - An explicit key for restoring and saving the cache
* `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key. Note
`cache-hit` returns false in this case.
* `reeval-key` - A boolean which causes the key to be re-evaluated during the Post-Action step
#### Environment Variables
* `SEGMENT_DOWNLOAD_TIMEOUT_MINS` - Segment download timeout (in minutes, default `60`) to abort download of the segment if not completed in the defined number of minutes. [Read more](#cache-segment-restore-timeout)

View File

@ -14,6 +14,10 @@ inputs:
upload-chunk-size:
description: 'The chunk size used to split up large files during upload, in bytes'
required: false
reeval-key:
description: 'Re-evaluate the cache key during the post-action'
required: false
default: false
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'

View File

@ -4947,6 +4947,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {

6
dist/save/index.js vendored
View File

@ -4947,6 +4947,7 @@ var Inputs;
Inputs["Path"] = "path";
Inputs["RestoreKeys"] = "restore-keys";
Inputs["UploadChunkSize"] = "upload-chunk-size";
Inputs["ReEvalKey"] = "reeval-key";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
@ -47297,8 +47298,9 @@ function run() {
return;
}
const state = utils.getCacheState();
// Inputs are re-evaluted before the post action, so we want the original key used for restore
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
const primaryKey = core.getBooleanInput(constants_1.Inputs.ReEvalKey)
? core.getInput(constants_1.Inputs.Key, { required: true })
: core.getState(constants_1.State.CachePrimaryKey);
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`);
return;

View File

@ -2,7 +2,8 @@ export enum Inputs {
Key = "key",
Path = "path",
RestoreKeys = "restore-keys",
UploadChunkSize = "upload-chunk-size"
UploadChunkSize = "upload-chunk-size",
ReEvalKey = "reeval-key"
}
export enum Outputs {

View File

@ -26,8 +26,9 @@ async function run(): Promise<void> {
const state = utils.getCacheState();
// Inputs are re-evaluted before the post action, so we want the original key used for restore
const primaryKey = core.getState(State.CachePrimaryKey);
const primaryKey = core.getBooleanInput(Inputs.ReEvalKey)
? core.getInput(Inputs.Key, { required: true })
: core.getState(State.CachePrimaryKey);
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`);
return;