Skip to content

Keep getting yarn cache is not found  #410

Closed

Description

@mmahalwy

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

Activity

  1. dmitry-shibanov commented on Jan 25, 2022

    @dmitry-shibanov
    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.

  2. mmahalwy commented on Jan 25, 2022

    @mmahalwy
    Author

    its sadly a private repo :(

  3. dmitry-shibanov commented on Jan 26, 2022

    @dmitry-shibanov
    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.
  4. dmitry-shibanov commented on Feb 7, 2022

    @dmitry-shibanov
    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.

  5. mmahalwy commented on Feb 7, 2022

    @mmahalwy
    Author

    ty

  6. tom-spalding commented on Jul 13, 2023

    @tom-spalding

    I have this issue as well

  7. djohts commented on Jul 18, 2023

    @djohts

    Having this issue too: first run, second run

  8. tom-spalding commented on Jul 19, 2023

    @tom-spalding

    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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions