-
Notifications
You must be signed in to change notification settings - Fork 2
CI Integration
wangliang edited this page Jul 25, 2026
·
2 revisions
ai-coding-ok 如何与 CI/CD 流水线集成,强制执行记忆更新并验证安装完整性。
ai-coding-ok 在你的项目中安装两个 CI 工作流文件:
.github/workflows/
├── ci.yml # 标准 CI 流水线模板
└── memory-check.yml # 记忆更新强制执行
记忆强制执行工作流——在每次 PR 时运行:
name: 记忆检查
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-memory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # 需要完整历史用于 diff
- name: 检查 task-history.md 是否更新
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "task-history.md"; then
echo "✅ task-history.md 已更新"
else
echo "⚠️ task-history.md 未在此 PR 中更新"
exit 1
fi
- name: 检查未填充占位符
run: |
if grep -r "{{.*}}" .github/agent/ AGENTS.md CLAUDE.md 2>/dev/null; then
echo "❌ 发现未填充占位符!"
exit 1
fi| 检查项 | 验证什么 | 严重程度 |
|---|---|---|
task-history.md 已修改 |
Act 阶段已完成 | |
无 {{占位符}} 残留 |
安装完整 | ❌ 错误(阻断合并) |
| 版本标记一致 | 无部分升级损坏 | |
| 所有必需文件存在 | 安装完整 | ❌ 错误 |
在 GitHub 仓库设置中:
- Settings → Branches → Branch protection rules
- 为
main添加规则 - 勾选"Require status checks to pass before merging"
- 搜索
memory-check并添加
- name: 检查 task-history.md 是否更新
run: |
if git diff ... | grep -q "task-history.md"; then
echo "✅ 已更新"
else
echo "::warning::task-history.md 未更新"
# 不 exit 1——仅警告
fi- name: 检查是否纯文档 PR
run: |
if git diff --name-only ... | grep -v "\.md$" | grep -v "^docs/"; then
echo "has_code=true" >> $GITHUB_OUTPUT
fi在 CI 中运行验证脚本作为门禁:
- name: 验证 ai-coding-ok 安装
run: |
bash /path/to/ai-coding-ok/scripts/verify.sh对于使用 ai-coding-ok 的多个仓库:
在 .github 仓库中创建共享工作流,各仓库引用:
# 各仓库中
jobs:
memory:
uses: your-org/.github/workflows/ai-coding-ok-check.yml首次 PR 没有之前的 task-history 可 diff。确保 PR 本身修改了 task-history.md。
检查 checkout action 中 fetch-depth: 0 是否设置。没有它,git diff 对 base 分支无效。
将 verify.sh 提交到项目的 scripts/ 目录,或在 CI 中引用 ai-coding-ok 仓库的完整路径。
🧠 ai-coding-ok — AI 编程的 PDCA 记忆闭环。
GitHub · Issues · MIT License