Skip to content

Cache

Cache #149

Workflow file for this run

name: Cache
on:
push:
schedule:
- cron: "0 0 1 * *" # Midnight every month (UTC)
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
path: dates.txt
key: dates-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
dates-${{ github.run_id }}-
dates-
- name: Show dates.txt
run: |
if [[ -f 'dates.txt' ]]; then
cat dates.txt
else
echo 'File not found. Creating...'
touch dates.txt
fi
- name: Add today and take top 5
run: |
date -u '+%Y-%m-%d %H:%M:%S UTC' > today.txt
cat today.txt dates.txt | head -n 5 | tee new_dates.txt
cp new_dates.txt dates.txt