Skip to content

Commit

Permalink
chore(workflow): 添加每日汇率获取工作流
Browse files Browse the repository at this point in the history
每天 00:00 UTC 自动执行,支持手动触发,获取最新汇率并部署到 GitHub Pages
  • Loading branch information
alanhe421 committed Dec 17, 2024
1 parent 820bea8 commit 799bf34
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/exchange-rate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Fetch Exchange Rates Daily

on:
schedule:
- cron: '0 0 * * *' # 每天 00:00 UTC 执行
workflow_dispatch: # 手动触发 workflow

jobs:
fetch-exchange-rates:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Fetch Exchange Rates
env:
ACCESS_KEY: ${{ secrets.EXCHANGE_API_KEY }}
run: |
echo "Fetching latest exchange rates..."
curl -s "https://api.exchangeratesapi.io/v1/latest?access_key=${ACCESS_KEY}" -o public/exchange-rates.json
echo "Fetched successfully."
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build
branch: main
clean: true

0 comments on commit 799bf34

Please sign in to comment.