Skip to content

Sync Plugin Seed Data #574

Sync Plugin Seed Data

Sync Plugin Seed Data #574

# ---------------------------------------------------------------------------
# 插件种子数据自动同步
# 定期运行 scripts/search-deepseek-repos.mjs + scripts/sync-discussions.mjs 抓取
# 插件生态与讨论数据,再由 scripts/publish-cache.mjs 发布到 `cache` 孤儿分支
# (洁癖单 commit + force push,不污染 main 历史)。
# 前端从 raw.githubusercontent.com/{owner}/{repo}/cache/<file> 读取。
#
# 同步周期:每小时一次(cron "15 * * * *",每小时的第 15 分钟 UTC 触发)
# 选择理由:
# · star 数 / 新仓库 / 推送动态为小时级变化,每小时同步保持最及时
# · 单次运行极短(仅 1 个官方 topic + 官方库兜底查询,per_page=100 分页,
# 2s 节流),24 次/天仍远低于免费额度 2000 分钟/月
# · 分钟数固定 23 分,避免与其它仓库的整点 cron 抢资源
# GitHub Search API 限额:带 token 30 req/min;仅 1 个 topic 查询 + 官方库
# 兜底,请求量极少,配额见底自动停止保底。
# ---------------------------------------------------------------------------
name: Sync Plugin Seed Data
on:
schedule:
- cron: "15 * * * *"
workflow_dispatch: {} # 手动触发(Actions 页面 "Run workflow")
# 允许 push cache 分支(contents: write)+ 读自家仓库 discussions(discussions: read)
permissions:
contents: write
discussions: read
concurrency:
group: sync-plugin-seed
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: 检出仓库
uses: actions/checkout@v7
with:
# 完整历史:publish-cache.mjs 依赖本地 git worktree / branch 操作
fetch-depth: 0
- name: 安装 pnpm
uses: pnpm/action-setup@v6
# ⚠️ 不写 version:pnpm 版本由 package.json 的 packageManager 字段
#(pnpm@11.20.0)精确指定,两处都写会报 "Multiple versions of pnpm specified"
- name: 安装 Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: pnpm
- name: 安装依赖
run: pnpm install --frozen-lockfile
- name: 抓取插件与讨论数据
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 官方 deepseek-ai 讨论需个人 PAT(GITHUB_TOKEN 是 integration token,
# 脚本照常写 scripts/output/*.json,供 publish:cache 读取。
# 仅索引官方 topic dsh-plugin(无 star 门槛 / 关键词等其它条件);
# 并发 6 + 全局限速 30 req/min。
run: pnpm search:plugins && pnpm sync:discussions
- name: 配置 Git 身份(cache 分支提交需要)
run: |
git config --global user.name "deepsea-cache-bot"
git config --global user.email "cache-bot@deepsea.local"
- name: 发布到 cache 分支(洁癖单 commit + force push)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm publish:cache