You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have setup the save always to true such that the cache step should always fail even if one of the tasks fail. See screenshots below:
Save always set to true in step:
Then further in the job a step fails but the post cache step is not run unlike the post repositry setup:
👋 Thank you for the bug report and apologies for the lack of a timely response.
As I shared in #1325 (comment), I do not believe this is a feature we can support in this action today due to limitations in what's possible in post-if expressions.
As @DanMawdsleyBA shared above, if you want to override the post-if behavior of the default cache action you can utilize the separate actions/cache/save and actions/cache/restore. This sort of granularity is what these actions were originally intended for - #1035.
Given that save-always never worked, I believe it would make the most sense to deprecate that action input and remove it in a future version release. It's not something we can confidently support long term with the current features of post-if - any workarounds we implement today are likely to break in the future if they're relying on undocumented behavior. #1242 should not have been approved or merged without sufficient testing from us to validate that it was working as intended.
My current plan is to:
Deprecate save-always in the current major version to indicate to users that it's not working as intended
Document in the README how to support this scenario with actions/cache/save
Remove save-always in the next major version
I realize this won't likely won't be a popular course of action, but I believe it's best for the long term maintainability of this action. I'd appreciate any and all feedback here, especially around the propose workaround if scenarios where it might not work.
Reacted by Sukka, Andrei Radulescu, Clémence Lesné, Florian Koch, Danila Danko and William Entriken
I was thinking it'd make sense to include the cache-hit output in that if conditional. The dedicated save cache action won't have access to the intra action state used by the restore step to indicate if the save is necessary.
Activity
DanMawdsleyBA commentedon Jan 30, 2024
For context this is how I did save cache in v3:
I think we can also optimise like this to not attempt to save cache when there was a cache hit
ci: Fix JS caching (#270)
SukkaW commentedon Feb 8, 2024
I am also facing this issue. With
save-always: true, thePost Cacheis still skipped if the previous build step has failed:sascha-wolf commentedon Feb 27, 2024
We're observing the same issue. It just doesn't seem to work as documented.

The "save-always" flag in actions/cache is broken
#2 change from `save-always` flag to `if: always()` see actions/cache…
# This is a combination of 31 commits.
# This is a combination of 31 commits.
joshmgross commentedon Jun 12, 2024
👋 Thank you for the bug report and apologies for the lack of a timely response.
As I shared in #1325 (comment), I do not believe this is a feature we can support in this action today due to limitations in what's possible in
post-ifexpressions.As @DanMawdsleyBA shared above, if you want to override the
post-ifbehavior of the default cache action you can utilize the separateactions/cache/saveandactions/cache/restore. This sort of granularity is what these actions were originally intended for - #1035.That might look something like:
Given that
save-alwaysnever worked, I believe it would make the most sense to deprecate that action input and remove it in a future version release. It's not something we can confidently support long term with the current features ofpost-if- any workarounds we implement today are likely to break in the future if they're relying on undocumented behavior. #1242 should not have been approved or merged without sufficient testing from us to validate that it was working as intended.My current plan is to:
save-alwaysin the current major version to indicate to users that it's not working as intendedactions/cache/savesave-alwaysin the next major versionI realize this won't likely won't be a popular course of action, but I believe it's best for the long term maintainability of this action. I'd appreciate any and all feedback here, especially around the propose workaround if scenarios where it might not work.
ruffsl commentedon Jun 18, 2024
@joshmgross , is there more that should be added to specified here?
joshmgross commentedon Jun 18, 2024
I was thinking it'd make sense to include the
cache-hitoutput in thatifconditional. The dedicated save cache action won't have access to the intra action state used by the restore step to indicate if the save is necessary.cache/src/saveImpl.ts
Lines 46 to 48 in 0c45773
Use separate cache step to save via if always
Save benchmark cache even the job is failed (#5694)
Ensure cache is always saved
Deprecate `save-always` input
Bug actions/cache#1315 <-- save-always not working.
fulldecent commentedon Sep 9, 2024
Here is the current documentation with the workaround.
And it does NOT recommend using save-always
https://github.com/actions/cache/blob/main/caching-strategies.md#saving-cache-even-if-the-build-fails
smoke tests: leverage caching (#4665)
Deprecate `save-always` input (#1452)
joshmgross commentedon Oct 7, 2024
save-alwayshas been deprecated as it's not something we can support at this time. #1452See #1315 (comment) for more details.
CI: migrate cache save always
CI: migrate cache save always
fix: vulnerabilities (#2)
Use separate cache step to save via if always
Merge pull request actions#1747 from actions/yacaovsnc/update-depende…
Fix native addon cache ordering and force baseline x64 ISA
Restore Windows x64 release packaging, fix oh-my-pi CI provisioning g…