-
Notifications
You must be signed in to change notification settings - Fork 2
CI Integration
How ai-coding-ok integrates with CI/CD pipelines to enforce memory updates and verify installation integrity.
ai-coding-ok installs two CI workflow files into your project:
.github/workflows/
├── ci.yml # Standard CI pipeline template
└── memory-check.yml # Memory update enforcement
A template CI pipeline that you customize for your tech stack:
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup {{language}}
# Customize for your language
- name: Install dependencies
run: {{package-manager}} install
- name: Run tests
run: {{test-framework}}
- name: Verify ai-coding-ok
run: bash scripts/verify.shThe placeholders ({{language}}, {{package-manager}}, {{test-framework}}) are filled during installation based on your tech stack.
The memory enforcement workflow — runs on every PR:
name: Memory Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-memory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history for diff
- name: Check task-history.md was updated
id: memory
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q ".github/agent/memory/task-history.md"; then
echo "✅ task-history.md updated"
echo "updated=true" >> $GITHUB_OUTPUT
else
echo "⚠️ task-history.md was NOT updated in this PR"
echo "updated=false" >> $GITHUB_OUTPUT
fi
- name: Check for unfilled placeholders
run: |
if grep -r "{{.*}}" .github/agent/ AGENTS.md CLAUDE.md 2>/dev/null; then
echo "❌ Unfilled placeholders found!"
exit 1
fi
echo "✅ No unfilled placeholders"
- name: Comment on PR (if memory not updated)
if: steps.memory.outputs.updated == 'false'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `⚠️ **Memory Check Failed**
\`task-history.md\` was not updated in this PR.
Please add a task-history entry:
\`\`\`markdown
### [TASK-XXX] Brief description
- **Date**: $(date +%Y-%m-%d)
- **Type**: feat | fix | refactor | chore
- **Summary**: What this PR does
- **Files changed**: Key files
\`\`\`
See [PDCA Workflow](https://github.com/Mark7766/ai-coding-ok/wiki/PDCA-Workflow) for details.`
});| Check | What it verifies | Severity |
|---|---|---|
task-history.md modified |
Act phase was completed | |
No {{placeholders}} in files |
Installation was complete | ❌ Error (blocks merge) |
| Version markers consistent | No partial upgrade corruption | |
| All required files present | Installation is intact | ❌ Error |
To enforce memory checks before merging:
- Go to Settings → Branches → Branch protection rules
- Add rule for your default branch (
main) - Check "Require status checks to pass before merging"
- Search for
memory-checkand add it - Save
Now no PR can merge without passing the memory check.
If you want to warn but not block:
- name: Check task-history.md was updated
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q ".github/agent/memory/task-history.md"; then
echo "✅ task-history.md updated"
else
echo "::warning::task-history.md was not updated"
# Don't exit 1 — just warn
fiSkip memory check for documentation-only PRs:
- name: Check if docs-only PR
id: docs_only
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -v "\.md$" | grep -v "^docs/"; then
echo "has_code=true" >> $GITHUB_OUTPUT
else
echo "has_code=false" >> $GITHUB_OUTPUT
fi
- name: Check task-history.md
if: steps.docs_only.outputs.has_code == 'true'
run: |
# ... memory check logicThe verify.sh script can run in CI as a gate:
- name: Verify ai-coding-ok installation
run: |
bash /path/to/ai-coding-ok/scripts/verify.sh
case $? in
0) echo "✅ Installation verified" ;;
1) echo "❌ Missing files" && exit 1 ;;
2) echo "⚠️ Unfilled placeholders" && exit 1 ;;
esacFor organizations with many repos using ai-coding-ok:
Create a shared workflow in .github repo:
# your-org/.github/workflows/ai-coding-ok-check.yml
name: ai-coding-ok Memory Check
on:
workflow_call:
jobs:
check-memory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check memory update
run: |
# ... memory check logicThen in each repo:
# repo/.github/workflows/memory-check.yml
name: Memory Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
memory:
uses: your-org/.github/workflows/ai-coding-ok-check.ymlThe first PR after install has no previous task-history to diff against. The check should pass if task-history.md was modified in the PR (which it should be, since you're adding the Act phase entry).
Check that fetch-depth: 0 is set in the checkout action. Without it, git diff against the base branch won't work.
The verify.sh script is in the ai-coding-ok repo, not in your project. Either:
- Commit
verify.shto your project'sscripts/directory - Or reference the ai-coding-ok repo path in CI
- Team Best Practices — making memory checks part of your team workflow
- Installation Verification — manual verification
- Troubleshooting — common CI issues
🧠 ai-coding-ok — AI 编程的 PDCA 记忆闭环。
GitHub · Issues · MIT License