Skip to content

Update Exchange Rate #20

Update Exchange Rate

Update Exchange Rate #20

name: Update Exchange Rate
on:
schedule:
- cron: '30 1 * * *' # 每天UTC时间01:30,相当于北京时间09:30
workflow_dispatch: # 手动触发
permissions:
contents: write
jobs:
update-exchange-rate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install requests
- name: Fetch exchange rate from Alpha Vantage
env:
ALPHA_VANTAGE_API_KEY: ${{ secrets.ALPHA_VANTAGE_API_KEY }}
run: |
python update_exchange_rate.py
- name: Check for changes
id: git_diff
run: |
git fetch
git diff --exit-code || echo "Changes detected"
- name: Commit and push changes
if: steps.git_diff.outputs.'Changes detected'

Check failure on line 36 in .github/workflows/update_exchange_rate.yml

View workflow run for this annotation

GitHub Actions / Update Exchange Rate

Invalid workflow file

The workflow is not valid. .github/workflows/update_exchange_rate.yml (Line: 36, Col: 13): Unexpected symbol: ''Changes detected''. Located at position 24 within expression: steps.git_diff.outputs.'Changes detected'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add exchange_rate.json
git commit -m "Update exchange rate"
git push origin HEAD:main