Daily Data Fetch #1651
This file contains 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: Daily Data Fetch | |
on: | |
schedule: | |
- cron: "0 */2 * * *" | |
# 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 }} |