Do not extract cache on job failure #32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-alwaysinput parameter is set totrue. This mirrors the behavior of the officialactions/cacheaction 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-extractioncannot 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/cacheand having the user explicitly setskip-extraction-on-failure: true, changing thepost-ifcondition tosuccess() || github.event.inputs.skip-extraction-on-failure == 'false'. I would personally prefer the change in this PR though as it seems more logical.