Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/scripts/validate-release-tag.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/validate-release-tag.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
5 changes: 5 additions & 0 deletions docs/测试与持续集成.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 验证真实部署包构建。
Loading