mirror of
https://github.com/actions/cache.git
synced 2025-07-17 12:25:15 -06:00
Fix caching using update key
This commit is contained in:
parent
2d697b4d9c
commit
5b41e77e7a
5 changed files with 21 additions and 28 deletions
22
src/save.ts
22
src/save.ts
|
@ -16,21 +16,25 @@ async function run(): Promise<void> {
|
|||
}
|
||||
|
||||
const state = utils.getCacheState();
|
||||
// Inputs are re-evaluated before the post action, so we want the original key used for restore
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (
|
||||
utils.isExactKeyMatch(primaryKey, state) &&
|
||||
!utils.getInputAsBoolean(Inputs.Update)
|
||||
) {
|
||||
core.info(
|
||||
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
||||
);
|
||||
return;
|
||||
if (utils.isExactKeyMatch(primaryKey, state)) {
|
||||
if (core.getInput(Inputs.Update) === "true") {
|
||||
core.info(
|
||||
`Cache hit occurred on the primary key ${primaryKey}, but updates were enabled, so updating cache.`
|
||||
);
|
||||
} else {
|
||||
core.info(
|
||||
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue