Allow updating cache with 'update' key

This commit is contained in:
davidsbond 2020-06-18 22:30:32 +01:00
parent eed9cfe64d
commit 2d697b4d9c
6 changed files with 62 additions and 4 deletions

View file

@ -16,15 +16,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
// Inputs are re-evaluated 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;
}
if (utils.isExactKeyMatch(primaryKey, state)) {
if (
utils.isExactKeyMatch(primaryKey, state) &&
!utils.getInputAsBoolean(Inputs.Update)
) {
core.info(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
);