1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-06-04 21:40:22 +02:00

Add new setting save-on-success.

* Proposal to implement https://github.com/actions/cache/issues/1570
This commit is contained in:
helly25 2025-03-11 21:19:20 +01:00
parent 5a3ec84eff
commit 40b3745dc1
No known key found for this signature in database
GPG key ID: 95B24A6EAE247816
2 changed files with 8 additions and 2 deletions

View file

@ -26,13 +26,18 @@ inputs:
description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache'
default: 'false'
required: false
save-on-success:
description: 'Whether the cache is written in the post action on success or (if false) is only restored'
default: 'true'
required: false
save-always:
description: 'Run the post step to save the cache even if another step before fails'
default: 'false'
required: false
deprecationMessage: |
save-always does not work as intended and will be removed in a future release.
A separate `actions/cache/restore` step should be used instead.
If you only want to control whether a new cache will be written use `save-always` instead.
Otherwise a separate `actions/cache/restore` step should be used instead.
See https://github.com/actions/cache/tree/main/save#always-save-cache for more details.
outputs:
cache-hit:
@ -41,7 +46,7 @@ runs:
using: 'node20'
main: 'dist/restore/index.js'
post: 'dist/save/index.js'
post-if: "success()"
post-if: "success() && github.event.inputs.save-on-success"
branding:
icon: 'archive'
color: 'gray-dark'