Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep getting yarn cache is not found #410

Closed
2 of 5 tasks
mmahalwy opened this issue Jan 25, 2022 · 9 comments
Closed
2 of 5 tasks

Keep getting yarn cache is not found #410

mmahalwy opened this issue Jan 25, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@mmahalwy
Copy link

Description:
Using yarn 1, continue getting yarn cache is not found on PRs that have run multiple times.
Weirdly, this works on pull_request but not on push events.

Push:

Run actions/setup-node@v2
Found in cache @ /opt/hostedtoolcache/node/16.13.2/x64
/usr/local/bin/yarn --version
1.22.17
/usr/local/bin/yarn cache dir
/home/runner/.cache/yarn/v6

yarn cache is not found

Pull request:

Run actions/setup-node@v2
Found in cache @ /opt/hostedtoolcache/node/16.13.2/x64
/usr/local/bin/yarn --version
1.22.17
/usr/local/bin/yarn cache dir
/home/runner/.cache/yarn/v6
Received 151904393 of 156098697 (97.3%), 144.9 MBs/sec
Received 156098697 of 156098697 (100.0%), 128.6 MBs/sec
Cache Size: ~149 MB (156098697 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/1233a9f5-f0f9-47e9-aaf5-472904875c75/cache.tzst -P -C /home/runner/work/alchemist/alchemist
Cache restored successfully

Cache restored from key: node-cache-Linux-yarn-c29c2173f71392ee46ad40a81d3756710c14774844267556986d4379721c0e46

Action version:
@2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
yarn 1

Repro steps:

name: Testing

on:
  push:
    branches:
      - '*'
  pull_request:
    types: [assigned, opened, synchronize, reopened, labeled]

jobs:
  testing:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '16'
          cache: 'yarn'
      - name: Install dependencies
        run: yarn install

Expected behavior:
Should cache on both push and pull request events

Actual behavior:
Only caches for pull request

@mmahalwy mmahalwy added bug Something isn't working needs triage labels Jan 25, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @mmahalwy. Thank you for your report. Could you please provide a public repository to reproduce the issue or a link to the build with issue. We've tried to reproduce it from our side but it works as expected.

@mmahalwy
Copy link
Author

its sadly a private repo :(

@dmitry-shibanov
Copy link
Contributor

Hello @mmahalwy. I can suppose two things:

  • It can be related to the cache-scope.
  • It can be related to the constant updating of the yarn.lock file, because the yarn install command can update dependencies. It updates the yarn.lock file and regenerate hash.

@dmitry-shibanov dmitry-shibanov self-assigned this Feb 7, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @mmahalwy. For now I'm going to close the issue because I've tried to reproduce the issue but it works as expected. If you get any additional information feel free to ping us.

@mmahalwy
Copy link
Author

mmahalwy commented Feb 7, 2022

ty

@dreamalligator
Copy link

I have this issue as well

@djohts
Copy link

djohts commented Jul 18, 2023

Having this issue too: first run, second run

@dreamalligator
Copy link

Here is something we can test @djohts. According to this answer https://stackoverflow.com/questions/55110729/how-do-i-cache-steps-in-github-actions/57958803#comment126885415_57958803 we might need to cache a second time in case of a miss.

Something that was not at all clear to me and is not explicitly mentioned anywhere in the documentation, is that when a cache search misses, the cache action evaluates the paths to subsequently store at the end of the job. I was confused why every example didn't have two uses of the cache action (1 to try to restore and then 1 to store after generating the files only if the cache missed), since the docs make it sound like the cache stores when the action is used, not at the end. It's somewhat implied by the cache only storing files if the job was successful but it could be more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants