Cache: Feature request: Ability to store cache if build fails

Created on 24 Apr 2020  路  5Comments  路  Source: actions/cache

This is for the docs:

If the job completes successfully, the action creates a new cache with the contents of the path directory.

In some cases it could be useful to store cache key even if some build steps are failed. Could you please define a new option that allows us to use such behavior?

feature request

Most helpful comment

Or maybe go around and allow users to specify where to insert the "save cache" step for better control, e.g., save cache between step N and step N+1, so when step N fails the cache is discarded while the failure of step N+1 doesn't affect cache saving.

All 5 comments

Or maybe go around and allow users to specify where to insert the "save cache" step for better control, e.g., save cache between step N and step N+1, so when step N fails the cache is discarded while the failure of step N+1 doesn't affect cache saving.

@sergeyzwezdin In case anyone finds this via search, this is relatively easy to do. You can fork this repo, remove one line in action.yml, and voila! Here is my own repo / commit that does this: https://github.com/jakemwood/cache/commit/d8a0d1ca35dc43ea043cfd82c5800c56a1e587a7

@jakemwood I don鈥檛 want to support my own repo for this 馃檪

We are investigating using RuboCop and if there are lint failures, the cache would not be updated, which doesn't make sense. In fact, I can't think of many situations where just because a build step fails, the cache should not be updated... At the very least, can we expose this as a configuration option?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KhaledSakr picture KhaledSakr  路  3Comments

jcornaz picture jcornaz  路  4Comments

dcecile picture dcecile  路  6Comments

FacetGraph picture FacetGraph  路  3Comments

binhxn picture binhxn  路  3Comments