Skip to content

Commit ec42969

Browse files
committed
Add a workflow to keep other scheduled workflows alive
GitHub disables scheduled workflows after 60 days of inactivity on a repository. Work around this by adding a scheduled workflow that creates a small commit once per month. Ported-from: https://github.com/git-for-windows/track-website-changes/blob/main/.github/workflows/keepalive.yml Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 571871d commit ec42969

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/keepalive.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Keep scheduled workflows alive
2+
3+
on:
4+
schedule:
5+
- cron: "23 19 17 * *" # 7:23pm on every 17th of the month
6+
workflow_dispatch:
7+
8+
jobs:
9+
job:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
permissions:
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: 'true'
19+
- name: Create and push a commit
20+
env:
21+
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@github'"
22+
run: |
23+
mkdir -p .github/cached
24+
file='.github/cached/keepalive.txt'
25+
date >$file
26+
git add "$file"
27+
git commit -m "workflow keepalive" &&
28+
git push origin HEAD </dev/null || {
29+
for i in 1 2 3 4 5
30+
do
31+
# In case of concurrent pushes, let's pull and push
32+
git pull origin $GITHUB_REF </dev/null || exit 1
33+
git push origin HEAD </dev/null && exit 0
34+
done
35+
exit 1
36+
}

0 commit comments

Comments
 (0)