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

Fails to restore absolute path #2

Open
davhdavh opened this issue Aug 15, 2023 · 0 comments
Open

Fails to restore absolute path #2

davhdavh opened this issue Aug 15, 2023 · 0 comments

Comments

@davhdavh
Copy link

Changing path from ./demo-output.txt to /tmp/demo-output.txt makes it always fail to restore.

name: DemoCache
on:
  push:
    branches:
    - main
  workflow_dispatch:

env:
  SHARED_CACHE_RUN_KEY: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}

jobs:
  first-run:
    runs-on: onsite
    steps:
    - uses: actions/checkout@v3
    - run: echo RUNNER_TOOL_CACHE is $RUNNER_TOOL_CACHE
    - run: printenv
    - name: 'Run first time without cache'
      id: 'first-run'
      uses: maxnowack/local-cache@v1
      with:
        path: '/tmp/demo-output.txt'
        key: ${{ env.SHARED_CACHE_RUN_KEY }}
    - name: Assert output
      if: steps.first-run.outputs.cache-hit == 'true'
      run: echo "Should not have done cache hit" && exit 1
    - name: Write cache file
      run: echo "demo-results" > /tmp/demo-output.txt

  second-run:
    runs-on: onsite
    needs: [first-run]
    steps:
    - uses: actions/checkout@v3
    - run: echo RUNNER_TOOL_CACHE is $RUNNER_TOOL_CACHE
    - run: printenv
    - uses: maxnowack/local-cache@v1
      id: 'second-run'
      with:
        path: '/tmp/demo-output.txt'
        key: ${{ env.SHARED_CACHE_RUN_KEY }}
    - name: Assert output
      if: steps.second-run.outputs.cache-hit != 'true'
      run: echo "Should have hit cache" && exit 1
    - name: Check contents
      run: cat /tmp/demo-output.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant