Feat: Control whether caches are written
In some cases you want to read but not save a new cache. For instance when you run workflows on a tag action, then you probably want to read caches from the main/default branch, but you most likely do not want to create new caches. The current solution is to separate restore and save actions which is cumbersome.
In https://github.com/actions/cache/pull/1452 the always_save feature was removed.
I propose to add a new config save-on-success that defaults to true and can be set false to prevent cache writing. Now this new value can be set from available context - just like you could when separating the steps - granted the decision must be available upfront. That above described decision is in fact available immediately on job creation. So we can use the new setting to simplify the setup.
A proposal to implement this is in https://github.com/actions/cache/pull/1571
See also https://github.com/actions/cache/discussions/1598
This would be very helpful to have.