Skip to content

Keep scheduled workflows alive #28

Keep scheduled workflows alive

Keep scheduled workflows alive #28

Workflow file for this run

name: Keep scheduled workflows alive
on:
schedule:
- cron: "16 07 10 * *"
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" &&
if test "$GITHUB_ACTOR" = nektos/act
then
echo "Would push commit:"
git -P show --stat
else
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
}
fi