Skip to content

try cache

try cache #13

Workflow file for this run

name: Detect Changes and Cache Folder
on:
push:
branches: [ try-cache ]
jobs:
jobone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: foo/bin
key: foocache-${{ hashFiles('foo/src/**') }}
- name: Write dummy file and save cache if needed
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p foo/bin
echo "Dummy file created at $(date)" > foo/bin/dummy.txt
echo "Cache updated"
jobtwo:
needs: jobone
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: foo/bin
key: foocache-
restore-keys: |
foocache-
- name: Use cached bin folder
run: |
ls -la foo/bin/
cat foo/bin/dummy.txt