Skip to content

Daily Data Fetch

Daily Data Fetch #29

name: Daily Data Fetch
on:
schedule:
- cron: "30 3 * * *" # 每天的 11:30 AM (中国时区)
- cron: "30 15 * * *" # 每天的 11:30 PM (中国时区)
# allows to manually run the job at any time
workflow_dispatch:
push:
branches:
- main # 当推送到 main 分支时触发工作流
jobs:
fetch-data:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4 # 使用最新版本
- name: Set up Bun
uses: oven-sh/setup-bun@v2 # 使用最新版本
with:
bun-version: "latest"
- name: Install dependencies
run: bun install
- name: Fetch data
run: bun run fetch-data
env:
API_KEY: ${{ secrets.API_KEY }}
MAX_DAYS: ${{ secrets.MAX_DAYS }}
- name: Commit and push changes
run: |
git config --local user.email "kevinxft@gmailcom"
git config --local user.name "kevinxft"
git add .
git commit -m "Update data for $(date +'%Y-%m-%d')"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}