Daily Runner #8
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: Daily Runner | |
on: | |
schedule: | |
- cron: '0 1 * * *' # Runs at 00:00 UTC every day | |
workflow_dispatch: # Also allows manual triggering | |
jobs: | |
run-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run cargo | |
run: cargo run | |
- name: Check for changes | |
id: git-check | |
run: | | |
git add result.json | |
git diff --staged --quiet || echo "changed=true" >> $GITHUB_ENV | |
- name: Commit changes | |
if: job.run-and-commit.steps.git-check.env.changed == 'true' | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email '[email protected]' | |
git commit -m "Auto-update result.json" | |
git push |