question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cache doesn't work with github workspace directory

See original GitHub issue

Hi, I’m trying to cache the whole workspace to fetch it between jobs. Unfortunately it seems like the local directory can not be cached

Using . doesn’t work (it cache 22B)

- name: Cache build folder
        uses: actions/cache@v3
        with:
          key: cs-repo-${{ github.run_number }}-${{ github.run_attempt }}
          path: .

Using ${{ github.workspace }} doesn’t work (it also cache 22B)

- name: Cache build folder
        uses: actions/cache@v3
        with:
          key: cs-repo-${{ github.run_number }}-${{ github.run_attempt }}
          path: ${{ github.workspace }}

the only solution I found which work is to list all the files/directory

- name: Cache build folder
        uses: actions/cache@v3
        with:
          key: cs-repo-${{ github.run_number }}-${{ github.run_attempt }}
          path: |
              file1
              file2
              dir1
              dir2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
erwan-jolycommented, Aug 5, 2022

@pdotl I confirm it’s now fixed 💯

1reaction
erwan-jolycommented, Aug 4, 2022

It doesn’t seems to be fixed for some reason 😕 I’ve tested with actions/cache@v3.0.1 both the two version with . and env variable and it still cache 22B @pdotl

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache doesn't work when the project is not in the root of ...
Use this directory to look for the pyproject.toml and cached deps. Justification: Caching doesn't work for projects where the project is not in ......
Read more >
Cache - excluding files or folders with ! not working #713
Describe the bug Excluding a file or folder does not work as expected with caching. For example, ~/cache !~/cache/subfolder is matching: .
Read more >
Caching dependencies to speed up workflows
To cache dependencies for a job, you can use GitHub's cache action. The action creates and restores a cache identified by a unique...
Read more >
Support hashing files outside the workspace directory #1035
Currently hashFiles ignores files outside the workspace. This means that it cannot be used to hash files which appear within an Action.
Read more >
setup-python failing due to missing cache directory #328
Description: This job on my repo has been failing since #303 was merged in. Only the python 11 alpha variant is failing due...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found