cache icon indicating copy to clipboard operation
cache copied to clipboard

Adding "always-save" flag to make #840 easier

Open martinheidegger opened this issue 3 years ago • 2 comments

The current recommendation has been a bit difficult for me to understand (and it seems i am not the only one?).

In this PR I implemented a always-save flag that makes this easier for me to understand.

martinheidegger avatar Jul 04 '22 14:07 martinheidegger

Hoping this is a major priority!

jacksongoode avatar Jul 28 '22 19:07 jacksongoode

I desperately need this feature.

My use case:

  • I need to access large amounts of data that is hosted in another git repository.
  • I clone the repository (if it doesn't exist) or do a git pull, if it exists, essentially keeping my cache up-to-date with the repository.
  • With the current implementation, it assumes that the cache is immutable, so I have to invalidate the entire cache every time there's a change in the other repository, essentially running git clone on every cache invalidation (I'm using as cache key the commit SHA of the remote repo's HEAD). The behavior I would like is to have a persistent cache and run git pull in it and save the resulting cache, therefore an always-save option would work very well for me.

With the current approach of immutable cache, every time there's a small change in the remote repo, I have to invalidate the entire cache and download it all again, even if it's a one-line change that would be way cheaper with a git pull and subsequently updating the cache.

Luc45 avatar Sep 15 '22 14:09 Luc45

LGTM.

@bishal-pdMSFT are you going to review or give an answer?

ErcinDedeoglu avatar Jan 12 '23 16:01 ErcinDedeoglu

We have released two new actions actions/cache/restore and actions/cache/save that take care of this case as well. You can now choose to run save action with condition if: always() and it will always save the cache for you for the given key.

We had released a beta to get user's feedback, discussion post here. And release post here.

Closing this as the use case as been implemented.

kotewar avatar Jan 14 '23 09:01 kotewar