Last active
April 20, 2026 14:01
-
-
Save rolandpeelen/5214b61de4a2e6ba2e237c6e9a81a52e to your computer and use it in GitHub Desktop.
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
| # In Justfile: | |
| # # Fetch exchange rates (ECB) | |
| # exchange-rates: | |
| # @echo "; EUR/CHF rates" > {{ exchange-rates }} | |
| # pricehist fetch ecb EUR/CHF --start 2025-01-01 --output ledger >> {{ exchange-rates }} | |
| # @echo "" >> {{ exchange-rates }} | |
| # @echo "; EUR/USD rates" >> {{ exchange-rates }} | |
| # pricehist fetch ecb EUR/USD --start 2025-01-01 --output ledger >> {{ exchange-rates }} | |
| # | |
| name: Update Exchange Rates | |
| on: | |
| schedule: | |
| # Run every day at 08:00 UTC | |
| - cron: '0 8 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-rates: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Just | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin | |
| - name: Install pricehist | |
| run: | | |
| pip install pricehist | |
| - name: Fetch exchange rates | |
| run: | | |
| just exchange-rates | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add exchange-rates.ledger | |
| git commit -m "Update exchange rates - $(date +'%Y-%m-%d')" | |
| git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment