Skip to content

Commit b8dd919

Browse files
committed
Cache demo
1 parent 93c96de commit b8dd919

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/cache.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Cache
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "0 0 1 * *" # Midnight every month (UTC)
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Cache dates
16+
id: cache-dates
17+
uses: actions/cache@v4
18+
with:
19+
path: dates.txt
20+
key: dates-${{ github.run_id }}.${{ github.run_attempt }}
21+
22+
- name: Initialize dates.txt
23+
if: steps.cache-dates.outputs.cache-hit != 'true'
24+
run: touch dates.txt
25+
26+
- name: Show current dates.txt
27+
run: cat dates.txt
28+
29+
- name: Add today to dates.txt
30+
run: |
31+
date -u "+%Y-%m-%d %H:%M:%S UTC" > today.txt
32+
cat today.txt dates.txt | head -n 5 > dates.txt
33+
34+
- name: Show updated dates.txt
35+
run: cat dates.txt

0 commit comments

Comments
 (0)