setting to keep cache even if job fails
I use this action for the cache of htmltest, a link checker. Often it'll get through plenty of links before finding a broken one, but because the job fails the cache isn't saved (and so if I re-run the action it has to check all the links again). I'd like for there to be a setting to keep the cache even if the job fails.
@kylrth cache save happens at the end of workflow run. This happens because the directory/file cached can change till the end of run. Saving cache after every step would create a lot of requests which many users won't want.
That's not what I'm asking for. For example, the checkout action has a post-run step that runs regardless of the success of previous steps, as you can see in this run on my repo. What I'd like is for there to be a setting such that the same behavior can happen for the cache action.
@kylrth actions/checkout runs for cleanup. If cache was allowed to save cache even on job fail then it could create corrupted cache, in most cases. If there is more request for this feature we would work on this.
I'm pretty sure that there already is more than a request for this feature (https://github.com/actions/cache/issues/92).
Thanks @jorgemo-fever for pointing that. We have internal discussions related to these issues.
I guess I'll close this issue then since it's a duplicate of #92. It's a shame this hasn't been added because there is definitely interest.
Hey everyone 👋🏽
Two new actions actions/cache/restore and actions/cache/save are now available with tag v3 to everyone for use. These can now be used to achieve granular control on the restore and save steps in the cache action.
Do try them and give your feedback. We believe these new actions will take care of your use cases. 🙇🏽
The save action can be made to run always by passing always() in the if condition.