From 79d69e57a98e4aa0b2fe3e84d6fbc00b01696c9d Mon Sep 17 00:00:00 2001 From: Logic <241731638@m.gduf.edu.cn> Date: Tue, 17 Nov 2026 18:02:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BF=9D=E7=95=99=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=97=A8=E7=A6=81=E7=9A=84=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actions 上下文的仓库身份来自原型 getter,对象展开导致首次标签构建丢失仓库信息。显式传递 repo 并增加真实形态回归,保留固定提交、长期分支 CI 与 CodeQL 的原有校验。同步记录失败边界,保留 rc.1 并以 rc.2 重新验证发布。 --- .github/scripts/validate-release-tag.cjs | 3 ++- .github/scripts/validate-release-tag.test.cjs | 19 +++++++++++++++++++ ...01\347\273\255\351\233\206\346\210\220.md" | 5 +++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/scripts/validate-release-tag.cjs b/.github/scripts/validate-release-tag.cjs index a7a8e81..c0f357a 100644 --- a/.github/scripts/validate-release-tag.cjs +++ b/.github/scripts/validate-release-tag.cjs @@ -59,7 +59,8 @@ async function requireLongTermBranchChecks({ github, context, core, sha, for (const branch of ['main', 'agent']) { try { await verify({ github, core, - context: { ...context, sha, ref: `refs/heads/${branch}`, eventName: 'workflow_dispatch' } }) + context: { ...context, repo: context.repo, sha, + ref: `refs/heads/${branch}`, eventName: 'workflow_dispatch' } }) core.info(`发布提交已通过长期分支门禁:${branch}@${sha}`) return branch } catch (error) { diff --git a/.github/scripts/validate-release-tag.test.cjs b/.github/scripts/validate-release-tag.test.cjs index eaac473..cd4bb73 100644 --- a/.github/scripts/validate-release-tag.test.cjs +++ b/.github/scripts/validate-release-tag.test.cjs @@ -200,6 +200,25 @@ test('main 通过时使用固定 SHA 合成门禁上下文,不修改原 contex assert.deepEqual(state.warnings, []) }) +test('门禁保留 Actions Context 原型 getter 提供的仓库身份', async () => { + const state = fixture() + const repository = state.args.context.repo + const prototype = { get repo() { return repository } } + const actionContext = Object.create(prototype) + for (const [name, value] of Object.entries(state.args.context)) { + if (name !== 'repo') actionContext[name] = value + } + assert.equal(Object.hasOwn(actionContext, 'repo'), false) + const branch = await requireLongTermBranchChecks({ ...state.args, context: actionContext, + sha: COMMIT, verify: async ({ context }) => { + const { owner, repo } = context.repo + assert.deepEqual({ owner, repo }, repository) + assert.equal(context.sha, COMMIT) + } }) + assert.equal(branch, 'main') + assert.equal(actionContext.repo, repository) +}) + test('main 候选失败必须报告原因,并允许同 SHA 的 agent 成功', async () => { const state = fixture() const calls = [] diff --git "a/docs/\346\265\213\350\257\225\344\270\216\346\214\201\347\273\255\351\233\206\346\210\220.md" "b/docs/\346\265\213\350\257\225\344\270\216\346\214\201\347\273\255\351\233\206\346\210\220.md" index c35f980..c39701a 100644 --- "a/docs/\346\265\213\350\257\225\344\270\216\346\214\201\347\273\255\351\233\206\346\210\220.md" +++ "b/docs/\346\265\213\350\257\225\344\270\216\346\214\201\347\273\255\351\233\206\346\210\220.md" @@ -160,3 +160,8 @@ ZIP 内顶层目录为 `mathcraft-{version}/`,包含已提交的后端运行 本地回归使用临时假 Git 仓库、假静态文件与假 API,不读取真实配置、不调用真实模型或 Redis。 验收包括 SemVer 边界、ZIP 内容与清单、提交一致性、敏感路径排除及工作流静态校验; 真实版本标签由用户选择并创建,不以自动创建版本标签作为配置验收手段。 + +首次标签 `0.2.0-rc.1` 的完整 CI 通过,构建在长期分支门禁处失败:Actions Context 的 `repo` +来自原型 getter,对上下文使用对象展开会丢失仓库身份。门禁适配器显式保留 `context.repo`, +并通过原型 getter 回归验证;继续核对原有固定 SHA、分支、完整 CI 与 CodeQL 条件。 +保留已推送的 `0.2.0-rc.1`,修复后使用新版本 `0.2.0-rc.2` 验证真实部署包构建。