Update Currency Rates and Posts #309
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: Update Currency Rates and Posts | |
| on: | |
| schedule: | |
| - cron: '0 */4 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update-and-generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: pip install requests pyyaml | |
| - name: Run update script | |
| env: | |
| CURRENCY_API_KEY: ${{ secrets.CURRENCY_API_KEY }} | |
| run: python scripts/update_rates.py | |
| # CRITICAL CHANGE HERE: The action will now commit changes in both _data and _posts. | |
| - name: Commit and push if changed | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "Automated: Update currency rates and generate daily posts" | |
| # This pattern tells the action to look for the YAML file AND any Markdown files in _posts | |
| file_pattern: "_data/rates.yml _posts/*.md" | |
| commit_user_name: "GitHub Actions Bot" | |
| commit_user_email: "github-actions-bot@users.noreply.github.com" | |