Add option to re-evaluate cache key during post action
This commit is contained in:
parent
a3f5edc237
commit
2935c2ea27
|
@ -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
|
* `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
|
* `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.
|
`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
|
#### Environment Variables
|
||||||
* `SEGMENT_DOWNLOAD_TIMEOUT_MIN` - 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)
|
* `SEGMENT_DOWNLOAD_TIMEOUT_MIN` - 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)
|
||||||
|
|
|
@ -14,6 +14,10 @@ inputs:
|
||||||
upload-chunk-size:
|
upload-chunk-size:
|
||||||
description: 'The chunk size used to split up large files during upload, in bytes'
|
description: 'The chunk size used to split up large files during upload, in bytes'
|
||||||
required: false
|
required: false
|
||||||
|
reeval-key:
|
||||||
|
description: 'Re-evaluate the cache key during the post-action'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
outputs:
|
outputs:
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: 'A boolean value to indicate an exact match was found for the primary key'
|
description: 'A boolean value to indicate an exact match was found for the primary key'
|
||||||
|
|
|
@ -2,7 +2,8 @@ export enum Inputs {
|
||||||
Key = "key",
|
Key = "key",
|
||||||
Path = "path",
|
Path = "path",
|
||||||
RestoreKeys = "restore-keys",
|
RestoreKeys = "restore-keys",
|
||||||
UploadChunkSize = "upload-chunk-size"
|
UploadChunkSize = "upload-chunk-size",
|
||||||
|
ReEvalKey = "reeval-key"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Outputs {
|
export enum Outputs {
|
||||||
|
|
|
@ -26,8 +26,9 @@ async function run(): Promise<void> {
|
||||||
|
|
||||||
const state = utils.getCacheState();
|
const state = utils.getCacheState();
|
||||||
|
|
||||||
// Inputs are re-evaluted before the post action, so we want the original key used for restore
|
const primaryKey = core.getBooleanInput(Inputs.ReEvalKey)
|
||||||
const primaryKey = core.getState(State.CachePrimaryKey);
|
? core.getInput(Inputs.Key, { required: true })
|
||||||
|
: core.getState(State.CachePrimaryKey);
|
||||||
if (!primaryKey) {
|
if (!primaryKey) {
|
||||||
utils.logWarning(`Error retrieving key from state.`);
|
utils.logWarning(`Error retrieving key from state.`);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue