Skip to content

Update Currency Rates and Posts #2

Update Currency Rates and Posts

Update Currency Rates and Posts #2

Workflow file for this run

name: Update Currency Rates
on:
schedule:
# Runs automatically every 12 hours.
- cron: '0 */12 * * *'
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
jobs:
update-rates:
runs-on: ubuntu-latest
steps:
# Step 1: Check out your repository's code
- name: Check out repo
uses: actions/checkout@v4
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Step 3: Install necessary Python packages
- name: Install dependencies
run: pip install requests pyyaml
# Step 4: Run the Python script
# This is now a clean, single command. The API key is passed securely.
- name: Run update script
env:
CURRENCY_API_KEY: ${{ secrets.CURRENCY_API_KEY }}
run: python scripts/update_rates.py
# Step 5: Commit the updated rates.yml file back to your repository
- name: Commit and push if changed
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Automated: Update currency exchange rates"
file_pattern: "_data/rates.yml"
commit_user_name: "GitHub Actions Bot"
commit_user_email: "github-actions-bot@users.noreply.github.com"