Skip to content

Fetch Exchange Rates #778

Fetch Exchange Rates

Fetch Exchange Rates #778

Workflow file for this run

name: Fetch Exchange Rates
on:
workflow_dispatch:
schedule:
- cron: "0 0,8,16 * * *"
env:
APP_ID: ${{ secrets.APP_ID }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
ref: exchange-rates
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install requests
- name: Run fetch-rates.py script
run: python fetch-rates.py
- name: Fetch fiat
run: curl -X GET "https://openexchangerates.org/api/latest.json?app_id=$APP_ID" --output core/data/src/main/assets/fiat-rates.json
- name: Check if APP_ID secret is set
run: |
if [ -z "${{ secrets.APP_ID }}" ]; then
echo "APP_ID is NOT set"
else
echo "APP_ID is set (value is masked)"
fi
- name: Move JSON file to assets directory
run: mv crypto-rates.json core/data/src/main/assets/
- name: Push into Git
run: |-
git config --global user.email "[email protected]"
git config --global user.name "ARK Builders Bot"
git add core/data/src/main/assets/fiat-rates.json
git add core/data/src/main/assets/crypto-rates.json
git commit -m "Automatic update of rates" || echo "Nothing to commit"
git pull origin exchange-rates --no-edit
git push origin exchange-rates