Skip to content

fix(track): 用 Lithe Store Bot(GitHub App)合入组织插件 - #53

Merged
xiaoyumuxi merged 1 commit into
mainfrom
feat/track-store-bot-app
Nov 4, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
feat/track-store-bot-app

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

改动类型

  • 收录新插件
  • 新增版本
  • 修改插件信息
  • 撤回版本 / 下架插件(请写明原因)
  • 脚本、CI 或文档

插件

  • 插件 ID:不涉及(本 PR 不改 lithe-plugin-index.json)
  • 来源仓库:不涉及
  • 版本 / Release 链接:不涉及

改动内容

#50 用 deploy key 合入组织插件,但 Lithe-IDEA 组织禁用了 deploy key(添加时返回 Deploy keys are disabled for this repository),GitHub 也不允许把 GitHub Actions 加入仓库规则集的绕过名单。所以 #51(maven-build 0.1.2)只能保持打开并给出警告。这个 PR 改用组织自己的私有 GitHub App “Lithe Store Bot” 作为唯一的 bot 绕过者。

.github/workflows/track-releases.yml

  • 新增步骤 “Create the Lithe Store Bot token”:只在组织那一轮、并且仓库变量 STORE_BOT_APP_CLIENT_ID 不为空时,用 actions/create-github-app-token@v3(client-id + secret STORE_BOT_APP_PRIVATE_KEY)生成只能访问本仓库的 app token。
  • 删除 checkout 的 ssh-key 和 job 级 GH_TOKEN。checkout 以及三个调用 gh 的步骤统一使用同一个 token,优先级是 app token、可选的 STORE_BOT_TOKEN、GITHUB_TOKEN。组织外那一轮不生成 app token,写不了 main。用 app token 开的 PR 会触发 Validate index。
  • “Merge the organization pull request” 只使用 app token,不回退到其他 token。没有 app token 时给出警告,PR 保持打开。合并方式由“用 deploy key 快进 main,再轮询等 PR 变成 MERGED”改为 gh pr merge --squash --match-head-commit <本轮校验过的提交>:与仓库现有的 squash 历史一致;分支在校验之后被改动过时,GitHub 拒绝合并。合并失败时给出警告,PR 保持打开;合并成功后删除分支。

docs/maintainers.md

  • 自动合入的步骤改为 app token + squash 合并,回退条件和停用方法改为“删除仓库变量 STORE_BOT_APP_CLIENT_ID 或卸载 App”。
  • 信任边界补充:组织允许成员创建公开仓库时,每个组织成员都能不经 Store 审查,通过新建 lithe-plugin-* 仓库并发布 Release 把插件发布到 Store。
  • “需要的仓库设置”把 deploy key 改为 Lithe Store Bot:私有,只有 Contents 与 Pull requests 读写,不接收 webhook,只安装在本仓库。同时写明变量和 secret 的名字,说明规则集为什么用 App 绕过、绕过只放行这一个 App。
  • README 同步一节的“不使用 deploy key”改为“不使用 Lithe Store Bot”。

合并前后需要的设置

组织管理员运行一次配置脚本(GitHub App manifest 流程):

  1. 浏览器打开预填好的创建页面,点 Create。
  2. 脚本把 Client ID 存为变量 STORE_BOT_APP_CLIENT_ID,私钥直接存为 secret STORE_BOT_APP_PRIVATE_KEY,不落盘。
  3. 在安装页只选 Lithe-store。
  4. 脚本确认 App 能访问 Lithe-store 后,把它加进 “Only owners merge main” 的绕过名单。

没有配置时,组织那一轮行为和现在一样,只给出警告,所以设置可以在合并前做,也可以在合并后做。

验证

  • node --test scripts/store.test.mjs:52 通过,0 失败(本 PR 不改脚本)。
  • actionlint .github/workflows/*.yml:只有两条关于 actions/create-github-app-token@v3 的误报(“缺少 app-id”“没有 client-id 输入”)。actionlint 1.7.12(当前最新)内置的是旧版元数据;v3.3.0 的 action.yml 里推荐使用 client-id,app-id 已废弃且不再必填。仓库 CI 不运行 actionlint。
  • 配置脚本的单元测试:manifest 表单转义后原样提交到组织的创建页面,权限、私有、关闭 webhook、回调地址都正确;JWT 用 RS256 签名、有效期覆盖当前时间;更新绕过名单时保留 OrganizationAdmin,不重复添加 App。
  • 现有线上运行(feat(track): Lithe-IDEA 组织插件自动合入,组织外插件仍需审查 #50 的版本)已验证分范围扫描:组织那一轮开了 chore(index): 追踪 Lithe-IDEA 组织插件新版本 #51(maven-build 0.1.2),因为没有凭据只给出警告;组织外那一轮开了 chore(index): 追踪组织外插件新版本 #52(mise 0.1.0)等待审查。

自检

  • 我是该插件的作者或维护者(或已获得授权)(不涉及具体插件)
  • plugin.json 的 vendor.signatureRequirement 为 "none",ID 不在 dev.lithe.*(不涉及)
  • 已在本地运行 node scripts/validate-index.mjs --verify-archives(本 PR 不改索引)
  • 插件要运行的程序都已在 plugin.json 中声明,并在仓库 README 中说明(不涉及)
  • 没有修改已发布版本的 downloadURL / sha256,没有删除历史版本(撤回除外)

The Lithe-IDEA organization disables deploy keys, and GitHub does not accept GitHub Actions as a ruleset bypass actor. The organization scope now creates a token of the organization-owned Lithe Store Bot GitHub App and squash-merges the pull request with --match-head-commit. The ruleset bypass names only this app.
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 4, 2026 23:50
@xiaoyumuxi
xiaoyumuxi merged commit 3465f58 into main Nov 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant