Commit to keep workflows active #1125
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Commit to keep workflows active | |
on: | |
schedule: | |
- cron: '00 12 * * *' | |
jobs: | |
heartbeat: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Repository Heartbeat" | |
- name: Make & push an empty commit | |
run: | | |
last_commit="$(git show -s --format=%at)" | |
cutoff="$(date --date='50 days ago' +%s)" | |
if [ "$last_commit" -lt "$cutoff" ] | |
then git commit --allow-empty -m '[EMPTY] Commit to keep workflows active' | |
git push | |
else echo 'Latest activity was within past 50 days; not committing' | |
fi |