Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/workflows/keep-alive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,22 @@ jobs:
keep-workflow-alive:
name: Keep workflow alive
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: master

- name: Get date from 50 days ago
run: |
datethen=`date -d "-50 days" --utc +%FT%TZ`
echo "datelimit=$datethen" >> $GITHUB_ENV

- name: setup git config
if: github.event.repository.pushed_at <= env.datelimit
run: |
# setup the username and email.
git config user.name "Github Actions Keepalive Bot"
git config user.email "<>"

- name: commit IF last commit is older than 50 days
if: github.event.repository.pushed_at <= env.datelimit
run: |
git commit -m "Empty commit to keep the gihub workflows alive" --allow-empty
git push origin master
datethen=$(date -d "-50 days" --utc +%s)
last_push=$(git log -1 --format=%ct)
if [ "$last_push" -le "$datethen" ]; then
git config user.name "Github Actions Keepalive Bot"
git config user.email "<>"
git commit -m "Empty commit to keep the github workflows alive" --allow-empty
git push origin master
else
echo "Last commit is recent enough, skipping keepalive commit."
fi
Loading