Skip to content

Fails to restore absolute path #2

@davhdavh

Description

@davhdavh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions