Skip to content

Update exchange rates every 6 hours #29

Update exchange rates every 6 hours

Update exchange rates every 6 hours #29

Workflow file for this run

name: Update exchange rates every 6 hours
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
permissions:
contents: write
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Fetch & save rates
env:
ACCESS_KEY: ${{ secrets.EXCHANGE_API_KEY }}
run: |
mkdir -p data
curl -s "http://api.exchangeratesapi.io/v1/latest?base=EUR&access_key=${ACCESS_KEY}" \
-o data/rates.json
- name: Commit & push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data/rates.json
git diff --cached --quiet || git commit -m "chore: update exchange rates" && git push