Currently, the cache is always extracted from the build. This is likely unnecessary if the build fails.
This PR skips the extraction step if the workflow job fails unless the new save-always input parameter is set to true. This mirrors the behavior of the official actions/cache action which, by default, does not upload the cache if the workflow job fails.
The current set of inputs does not allow to replicate this behavior: skip-extraction cannot be used since success() or failure() cannot look ahead (and cannot be used for action inputs).
Note: This change is breaking as it changes previous behavior. This could be prevented by using a different approach than actions/cache and having the user explicitly set skip-extraction-on-failure: true, changing the post-if condition to success() || github.event.inputs.skip-extraction-on-failure == 'false'. I would personally prefer the change in this PR though as it seems more logical.
Motivation
Currently, the cache is always extracted from the build. This is likely unnecessary if the build fails.
This PR skips the extraction step if the workflow job fails unless the new
save-always
input parameter is set totrue
. This mirrors the behavior of the officialactions/cache
action which, by default, does not upload the cache if the workflow job fails.The current set of inputs does not allow to replicate this behavior:
skip-extraction
cannot be used sincesuccess()
orfailure()
cannot look ahead (and cannot be used for action inputs).Note: This change is breaking as it changes previous behavior. This could be prevented by using a different approach than
actions/cache
and having the user explicitly setskip-extraction-on-failure: true
, changing thepost-if
condition tosuccess() || github.event.inputs.skip-extraction-on-failure == 'false'
. I would personally prefer the change in this PR though as it seems more logical.