mirror of
https://gitea.com/actions/cache.git
synced 2024-11-23 12:52:28 +08:00
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
|
||||
* `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_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:
|
||||
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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user