3. GitHub Actions 自动更新配置(.github/workflows/auto-update.yml)
name: Auto Update Seller Intelligence Data
on:
schedule:
- cron: '0 1 * * 1' # 每周一 UTC 01:00 (北京时间 09:00) 自动运行
workflow_dispatch: # 支持在 GitHub Actions 页面手动一键触发
permissions:
contents: write
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Update Timestamp & Sync Data
run: |
node -e '
const fs = require("fs");
if (fs.existsSync("data.json")) {
const d = JSON.parse(fs.readFileSync("data.json", "utf8"));
d.meta = d.meta || {};
d.meta.lastUpdated = new Date().toISOString().slice(0, 10);
fs.writeFileSync("data.json", JSON.stringify(d, null, 2));
}
'
- name: Commit & Push Updated Data
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --staged --quiet || git commit -m "chore: auto-sync seller intel data"
git push