chore: update ci ndoe version #3
Workflow file for this run
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: Monthly Script Runner | ||
# 触发条件:每月的1号运行 | ||
on: | ||
schedule: | ||
- cron: "0 0 0 * *" # 每月一号的00:00 UTC时间运行 | ||
workflow_dispatch: | ||
jobs: | ||
run-scripts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# 检出代码 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# 设置 Node.js 环境 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' # 使用 Node.js 18 | ||
# 运行第一个脚本 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 }} | ||
# # 创建并推送 PR | ||
# - name: Create Pull Request | ||
# id: create_pr | ||
# uses: peter-evans/create-pull-request@v7 | ||
# with: | ||
# commit-message: "chore: Updating data from xlab" | ||
# title: "chore: Updating data from xlab" | ||
# body: "Updating data from xlab,and create user homepages" | ||
# branch: update-ranking-data | ||
# base: "main" | ||
# delete-branch: true | ||
# # 启用自动合并 | ||
# - name: Enable auto-merge | ||
# uses: peter-evans/enable-pull-request-automerge@v3 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} | ||
# merge-method: merge |