Skip to content

Keep scheduled workflows alive #1

Keep scheduled workflows alive

Keep scheduled workflows alive #1

Workflow file for this run

name: Keep scheduled workflows alive
on:
schedule:
- cron: "23 19 17 * *" # 7:23pm on every 17th of the month
workflow_dispatch:
jobs:
job:
runs-on: ubuntu-latest
strategy:
fail-fast: false
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: 'true'
- name: Create and push a commit
env:
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@github'"
run: |
mkdir -p .github/cached
file='.github/cached/keepalive.txt'
date >$file
git add "$file"
git commit -m "workflow keepalive" &&
git push origin HEAD </dev/null || {
for i in 1 2 3 4 5
do
# In case of concurrent pushes, let's pull and push
git pull origin $GITHUB_REF </dev/null || exit 1
git push origin HEAD </dev/null && exit 0
done
exit 1
}