Skip to content

Add fallback cache keys #1120

Open
Open

Description

@hyrious

Description:

Currently the cache key is always node-cache-{platform}-{packageManager}-{fileHash(lockfile)}, which means the cache is invalid if any one dependency changed. I want to achieve something like this restore-keys:

restore-keys: |
  npm-feature-${{ hashFiles('package-lock.json') }}
  npm-feature-
  npm-

Justification:

It would be very helpful if the same cache can be reused across many places even if their package.json has changed.

Are you willing to submit a PR?

I noticed that Yarn berry already has some logic about this, can we expand that use cases to all package managers?

Activity

  1. v-priyagupta108 commented on Aug 14, 2024

    @v-priyagupta108
    Contributor

    Hi @hyrious 👋,
    Thank you for the feature request. We'll investigate it and get back to you as soon as we have updates.

  2. stefanahman commented on Apr 2, 2026

    @stefanahman

    Amazing that this is not implemented yet :D

  3. deleted a comment from beanscg on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions