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:
parent
5c79b3fd6c
commit
fa2f4155aa
4 changed files with 45 additions and 6 deletions
16
src/save.ts
16
src/save.ts
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue