actions / actions/cache

cache/save does not support restore-keys

Open
#1,651 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with save/action.yml, especially the inputs shown around lines 4-17, and trace how the save action handles cache configuration. Look for the related TypeScript entry point and tests covering save and restore behavior; done means the requested restore-key configuration is accepted and follow-up runs can use those keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.