1
0
Fork 0
mirror of https://github.com/actions/cache.git synced 2025-07-15 09:20:46 +00:00

Add option reevaluate the key

This commit is contained in:
Matt Johnson-Pint 2022-11-18 14:19:10 -08:00
parent 5c79b3fd6c
commit fa2f4155aa
No known key found for this signature in database
GPG key ID: FC13C394A988CF1D
4 changed files with 45 additions and 6 deletions

View file

@ -26,11 +26,17 @@ 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);
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`);
return;
let primaryKey : string;
if (core.getInput(Inputs.ReevaluateKey)?.toLowerCase() === 'true') {
// Inputs are re-evaluated before the post action
primaryKey = core.getInput(Inputs.Key);
} else {
// Get the original key used for restore from the cache
primaryKey = core.getState(State.CachePrimaryKey);
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`);
return;
}
}
if (utils.isExactKeyMatch(primaryKey, state)) {