cache icon indicating copy to clipboard operation
cache copied to clipboard

cache/save does not support restore-keys

Open jmarrec opened this issue 3 months ago • 0 comments

I'm trying to run a workflow that basically builds a project, and runs tests. Tests take a very long time, and could fail. So I'm trying to do this

- name: Restore Cache
  uses: actions/cache/restore@v4
  id: restore-cache
  with:
    path: thepath/
    key: primary-key
    restore-keys: |
      restore-key1
      restore-key2

- name: build the project (which populates the cache)

- name: Save cache
  uses: actions/cache/save@v4
  if: always() && steps.restore-cache.outputs.cache-hit != 'true'
  with:
    path: thepath/
    key: ${{ steps.restore-cache.outputs.cache-primary-key }}
#    restore-keys: |
#      restore-key1
#      restore-key2

- name: Run long tests

It seems that actions/cache/save does not support restore-keys.

https://github.com/actions/cache/blob/638ed79f9dc94c1de1baef91bcab5edaa19451f4/save/action.yml#L4-L17

I'd like to tag my actions/cache/save cache with some restore keys for followup runs to be able to hit the restore keys. is there no way to do this?

jmarrec avatar Sep 11 '25 13:09 jmarrec