Skip to content

Commit d4c586e

Browse files
fix(ci): add ci fix for keeping repo alive
1 parent d4473e4 commit d4c586e

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/keepalive.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Keepalive
2+
3+
on:
4+
schedule:
5+
- cron: "45 5 * * 1"
6+
workflow_dispatch:
7+
8+
permissions: { contents: write }
9+
concurrency: { group: keepalive, cancel-in-progress: false }
10+
11+
jobs:
12+
keepalive:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Empty commit when the repo nears the scheduled-workflow disable window
17+
run: |
18+
days_old=$(( ( $(date -u +%s) - $(git log -1 --format=%ct) ) / 86400 ))
19+
echo "Last commit was $days_old day(s) ago"
20+
if [ "$days_old" -lt 45 ]; then
21+
echo "Fresh enough; nothing to do."
22+
exit 0
23+
fi
24+
git config user.name 'github-actions[bot]'
25+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
26+
git commit --allow-empty -m "chore(keepalive): keep scheduled workflows enabled [skip ci]"
27+
git push

0 commit comments

Comments
 (0)