actions / actions/toolkit

`@actions/cache`, why are paths needed to compute version

Open
#1,433 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When using the cache action, the path is used to generate a unique version.
Unfortunately depending on the runner type official or self-hosted) the workspace do changes and creates a different version.
This leads to a mistmatch and a failure.

To Reproduce
Steps to reproduce the behavior:

  1. Have self-hosted AND github runners available
  2. Create a workflow that cache some folders using ${{ github.workspace }}
  3. Have multiple matrix start and restore the said cache
  4. See failures on runs that are on a different type of runner than the one the cache was created on

Expected behavior
I do wonder why we actually care about the path at all when restoring?
If I did cache some folders, and I do want to restore them, shouldn't the cache key be enough to justify a proper cache match or miss?

Might be related: https://github.com/actions/toolkit/issues/1377

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 by reproducing the cache mismatch with self-hosted and GitHub-hosted runners, using ${{ github.workspace }} in a matrix workflow. Read the related issue in actions/toolkit#1377 and trace how @actions/cache computes its version. Done means establishing the intended role of paths and defining consistent cache restore behavior across runner types.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.