Update fetch.yml #28
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: Fetch exchange rates v2 | ||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '00 18 * * *' | ||
| push: | ||
| branches: | ||
| - exchange-rates | ||
| 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=${{secrets.APP_ID}}" --output core/data/src/main/assets/fiat-rates.json | ||
| - name: print secret | ||
| run: echo ${{secrets.APP_ID}} | ||
| - name: print to debug | ||
| run: cat core/data/src/main/assets/fiat-rates.json | ||
| #- 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 "Automated update of rates" || echo "Nothing to commit" | ||
| git pull origin exchange-rates --no-edit | ||
| git push origin exchange-rates | ||