Skip to content

@actions/cache: After modifying key, Cache not found for input keys: xxx will not be thrown #928

@liby

Description

@liby

Current Behavior

image

I modified key, but when I run the workflow, it still prompts me for Cache restored from key: Linux-jd-node-modules-xxxx.

Expected behavior

Isn’t it supposed to prompt me Cache not found for input keys: Linux-jd-node-modules-?

Suggested solution(s)

After modifying Key, the cache should not be restored from the previous key when the workflow is run for the first time.

Additional context

Before modification
    steps:
      - uses: actions/checkout@v2
      - name: Cache node_modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          path: node_modules
          key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
After modification
    steps:
      - uses: actions/checkout@v2
      - name: Cache node_modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          path: node_modules
          key: ${{ runner.os }}-${{ env.cache-name }}-

Your environment

  System:
    OS: Linux 5.4 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
    Memory: 4.80 GB / 6.79 GB
    Container: Yes
    Shell: 4.4.*** - /bin/bash
  Binaries:
    Node: 10.23.0 - /opt/hostedtoolcache/node/10.23.0/x64/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.8 - /opt/hostedtoolcache/node/10.23.0/x64/bin/npm
  Browsers:
    Chrome: 86.0.42***.183
    Firefox: 82.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: templatesRelated to an init template, not necessarily to core (but could influence core)scope: upstreamIssue in upstream dependencysolution: out-of-scopeThis is out of scope for this projectsolution: outdatedThis is not up-to-date with the current version

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions