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` 验证真实部署包构建。