Add option to re-evaluate cache key during post action

This commit is contained in:
Timo Rothenpieler 2021-11-05 16:19:11 +01:00
parent 5a3ec84eff
commit f0a29e5cc9
4 changed files with 10 additions and 4 deletions

View file

@ -5,7 +5,8 @@ export enum Inputs {
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
LookupOnly = "lookup-only" // Input for cache, restore action
LookupOnly = "lookup-only", // Input for cache, restore action
ReEvalKey = "reeval-key"
}
export enum Outputs {

View file

@ -34,9 +34,9 @@ export async function saveImpl(
// If restore has stored a primary key in state, reuse that
// Else re-evaluate from inputs
const primaryKey =
stateProvider.getState(State.CachePrimaryKey) ||
core.getInput(Inputs.Key);
const primaryKey = core.getBooleanInput(Inputs.ReEvalKey)
? core.getInput(Inputs.Key)
: (stateProvider.getState(State.CachePrimaryKey) || core.getInput(Inputs.Key));
if (!primaryKey) {
utils.logWarning(`Key is not specified.`);