Skip to content

chore(frontend): bump @emotion/react in /frontend #29

chore(frontend): bump @emotion/react in /frontend

chore(frontend): bump @emotion/react in /frontend #29

name: Update Exchange Rates
on:
push:
paths:
- '.github/workflows/update-exchange-rates.yaml'
# schedule:
# - '0 0 * * *'
workflow_dispatch:
defaults:
run:
shell: bash -exuo pipefail {0}
jobs:
update-currencies-file:
name: Update exchange rates file
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Fetch GreenSTAR secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
CURRENCY_API_KEY: "op://GreenSTAR/Currency API/api key 1"
POLYGON_KEY: "op://GreenSTAR/Polygon/api key"
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_GREENSTAR }}
- name: Fetch Development secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
DEPLOY_KEY: "op://Development/Recurring GitHub Jobs Deploy Key/private key?ssh-format=openssh"
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_DEVELOPMENT }}
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ env.DEPLOY_KEY }}
- name: Download currencies CSV
run: |
curl -G https://api.currencyapi.com/v3/currencies -H "apikey: ${CURRENCY_API_KEY}" \
| jq -r '.data[] | [ .code, .symbol, .symbol_native, .name, .decimal_digits, .rounding, .name_plural, .type, "{" + (.countries | join(",")) + "}" ] | @csv' > ./deploy/local/rates/currencies.csv
- name: Download exchange rates
run: |
rm -fv "./deploy/local/rates/exchange-rates.csv"
CURRENCIES=("AED" "AUD" "BRL" "EUR" "GBP" "ILS" "INR" "JPY" "KRW" "LBP" "MAD" "MVR" "MXN" "NOK" "NZD" "PLN" "RON" "SAR" "SCR" "SEK" "THB" "TRY" "UAH" "ZAR")
START_DATE="$(date -d "2 years ago" +"%Y-%m-%d")"
END_DATE="$(date +"%Y-%m-%d")"
for c in "${CURRENCIES[@]}"; do
curl -sSL "https://api.polygon.io/v2/aggs/ticker/C:${c}USD/range/1/day/${START_DATE}/${END_DATE}?apiKey=${POLYGON_KEY}" \
| jq -r ".results[] | [ (.t / 1000 | strftime(\"%Y-%m-%d\")), \"${c}\", \"USD\", .c, \"false\" ]|@csv" >> "./deploy/local/rates/exchange-rates.csv"
sleep 12
done
- name: Commit & Push changes
uses: EndBug/add-and-commit@v9
with:
add: './deploy/local/*.csv'
message: "Update exchange rates currencies file"