Skip to content

Monthly Script Runner #6

Monthly Script Runner

Monthly Script Runner #6

name: Monthly Script Runner
# 触发条件:每月的1号运行
on:
schedule:
- cron: "0 0 1 * *" # 每月一号的00:00 UTC时间运行
workflow_dispatch:
jobs:
run-scripts:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# 运行第一个脚本 sync_xlab.js,从接口获取最新数据
- name: Run sync_xlab.js
run: node script/sync_xlab.js
# 运行第二个脚本 update_year_user.js, 更新 rankingList.json
- name: Run update_year_user.js
run: node script/update_year_user.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 运行第三个脚本 front-matter.js, 批量创建详情页
- name: Run front-matter.js
run: node script/front-matter.js
# 提交并推送更改到 main 分支
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "chore: Automated data update from scripts"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}