Skip to content

CI Integration

mark7766 edited this page Jul 14, 2026 · 2 revisions

CI Integration

How ai-coding-ok integrates with CI/CD pipelines to enforce memory updates and verify installation integrity.


Overview

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

ci.yml

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.sh

The placeholders ({{language}}, {{package-manager}}, {{test-framework}}) are filled during installation based on your tech stack.


memory-check.yml

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.`
            });

What gets checked

Check What it verifies Severity
task-history.md modified Act phase was completed ⚠️ Warning (comment on PR)
No {{placeholders}} in files Installation was complete ❌ Error (blocks merge)
Version markers consistent No partial upgrade corruption ⚠️ Warning
All required files present Installation is intact ❌ Error

Making checks required

To enforce memory checks before merging:

  1. Go to Settings → Branches → Branch protection rules
  2. Add rule for your default branch (main)
  3. Check "Require status checks to pass before merging"
  4. Search for memory-check and add it
  5. Save

Now no PR can merge without passing the memory check.


Customizing CI for your project

Adjusting the memory check threshold

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
    fi

Excluding certain PR types

Skip 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 logic

Integrating verify.sh

The 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 ;;
    esac

Multi-repo CI

For organizations with many repos using ai-coding-ok:

Shared workflow (recommended)

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 logic

Then 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.yml

Troubleshooting CI

"memory-check always fails on the first PR"

The 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).

"memory-check passes but task-history wasn't updated"

Check that fetch-depth: 0 is set in the checkout action. Without it, git diff against the base branch won't work.

"verify.sh not found in CI"

The verify.sh script is in the ai-coding-ok repo, not in your project. Either:

  • Commit verify.sh to your project's scripts/ directory
  • Or reference the ai-coding-ok repo path in CI

Next steps

Clone this wiki locally