Auto-update Timestamp File #35
This file contains hidden or 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: Auto-update Timestamp File | |
on: | |
schedule: | |
- cron: '0 17 * * *' | |
workflow_dispatch: | |
jobs: | |
update_timestamp_job: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Update timestamp.txt | |
run: echo "Last update on $(date -u)" > timestamp.txt | |
- name: Commit and push if there are changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add timestamp.txt | |
if ! git diff --staged --quiet; then | |
git commit -m "chore: 🤖 Update timestamp file" | |
git push | |
else | |
echo "No changes to commit." | |
fi |