You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
A cache created in the first job of an action is not available in the second job. My idea was to create a separate github action with inputs to be called as the first job in every other github action to manage the cache and then just restore the cache in the second job (knowing that it will always exist), but this issue doesn't allow me to use this strategy
Action version:
actions/cache@v4
Platform:
Ubuntu
macOS
Windows
Runner type:
Hosted
Self-hosted
Tools version:
Node 20
Repro steps:
name: Proof of Concept
on:
workflow_dispatch:
jobs:
manage-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node Setup
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Restore Main Cache
id: main-cache
uses: actions/cache@v4
with:
path: ./x/node_modules
key: cart-cache-${{ hashFiles('x/package-lock.json') }}
- name: Install dependencies if cache miss
if: steps.main-cache.outputs.cache-hit != 'true'
working-directory: ./x
run: npm ci
react-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node Setup
uses: actions/setup-node@v4
with:
node-version: 20.x
# Next step should always be able to restore the cache but the first time always fails
- name: Restore cache
uses: actions/cache@v4
with:
path: ./x/node_modules
key: cart-cache-${{ hashFiles(x/package-lock.json') }}
Expected behavior:
The second job should be able to restore cache
Actual behavior:
The second job says can't found cache with key "y" (being "y" the key created in the first job that I can see that exists)
The text was updated successfully, but these errors were encountered:
Description:
A cache created in the first job of an action is not available in the second job. My idea was to create a separate github action with inputs to be called as the first job in every other github action to manage the cache and then just restore the cache in the second job (knowing that it will always exist), but this issue doesn't allow me to use this strategy
Action version:
actions/cache@v4
Platform:
Runner type:
Tools version:
Node 20
Repro steps:
Expected behavior:
The second job should be able to restore cache
Actual behavior:
The second job says can't found cache with key "y" (being "y" the key created in the first job that I can see that exists)
The text was updated successfully, but these errors were encountered: