File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Dummy Commit Every 50 Days
2+
3+ on :
4+ schedule :
5+ - cron : " 0 0 * * *"
6+ workflow_dispatch :
7+
8+ jobs :
9+ dummy-commit :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout repo
13+ uses : actions/checkout@v3
14+
15+ - name : Restore last-run cache
16+ id : cache
17+ uses : actions/cache@v4
18+ with :
19+ path : .last-run
20+ key : dummy-commit-last-run
21+
22+ - name : Check time since last run
23+ id : check
24+ run : |
25+ mkdir -p .last-run
26+ file=".last-run/timestamp"
27+
28+ if [ ! -f "$file" ]; then
29+ echo "No timestamp found. Proceeding."
30+ echo "run=true" >> $GITHUB_OUTPUT
31+ else
32+ last=$(cat "$file")
33+ now=$(date +%s)
34+ delta_days=$(( (now - last) / 86400 ))
35+ echo "Last run was $delta_days days ago."
36+
37+ if [ "$delta_days" -ge 50 ]; then
38+ echo "run=true" >> $GITHUB_OUTPUT
39+ else
40+ echo "run=false" >> $GITHUB_OUTPUT
41+ fi
42+ fi
43+
44+ - name : Make dummy commit
45+ if : steps.check.outputs.run == 'true'
46+ run : |
47+ echo "Dummy commit on $(date -u)" >> dummy_commit.log
48+ git config user.name "github-actions[bot]"
49+ git config user.email "github-actions[bot]@users.noreply.github.com"
50+ git add dummy_commit.log
51+ git commit -m "chore: dummy keep-alive commit"
52+ git push
53+
54+ - name : Save timestamp to cache
55+ if : steps.check.outputs.run == 'true'
56+ run : |
57+ date +%s > .last-run/timestamp
You can’t perform that action at this time.
0 commit comments