local-cache icon indicating copy to clipboard operation
local-cache copied to clipboard

Fails to restore absolute path

Open davhdavh opened this issue 1 year ago • 0 comments

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

davhdavh avatar Aug 15 '23 04:08 davhdavh