Skip to content

CI/CD Integration

This guide shows how to integrate coding standards into your continuous integration and deployment workflow so that standards drift is caught automatically.

Three layers keep your project in sync:

  1. Git hooks – detect updates after every pull or merge.
  2. Sync scripts – manually or programmatically update all agent configs.
  3. CI/CD checks – block pull requests when standards are out of date.

Add a job that fails when the standards submodule is behind the remote:

.github/workflows/standards-check.yml
name: Check Standards
on: [push, pull_request]
jobs:
check-standards:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Check standards are up to date
run: make check-standards

make check-standards compares the local submodule commit with origin/main. If they differ, the step exits with a non-zero code and the workflow fails.

The submodule can be current while a generated agent config (CLAUDE.md, AGENTS.md, .cursorrules, …) has drifted from what the standards would assemble. diff-standards.sh --exit-code catches that: it exits 1 when any declared agent’s assembled config would change or be created, and prints the exact command to fix it. Content below the BEGIN PROJECT-SPECIFIC marker is yours and never counts as drift. Auxiliary files that sync copies verbatim (.aiderrc, .gemini/settings.json, .claude/settings.json, Cursor commands) are outside the gate.

- name: Agent configs match the standards
run: ./.standards/scripts/diff-standards.sh --exit-code

Run it from the project root (never make -C .standards ...); the script refuses to run when the project root resolves to .standards/.

Create a workflow that opens a commit (or a pull request) when new standards are available:

.github/workflows/update-standards.yml
name: Update Standards
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at midnight UTC
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Update standards submodule
run: |
cd .standards
git pull origin main
cd ..
git add .standards
git commit -m "chore: update standards submodule" || exit 0
git push

The scripts/setup.sh script installs a post-merge hook that runs after every git pull or git merge. The hook fetches from the standards remote and prints a notice if newer commits exist. It does not pull or sync; you run the sync.

# Installed at .git/hooks/post-merge
#!/bin/bash
if [ -d ".standards" ]; then
cd .standards
git fetch origin >/dev/null 2>&1
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/main 2>/dev/null || git rev-parse origin/master 2>/dev/null)
if [ "$LOCAL" != "$REMOTE" ] && [ -n "$REMOTE" ]; then
echo "📋 Standards repository has updates. Run: ./.standards/scripts/sync-standards.sh"
fi
fi

Commit Message Hooks (Conventional Commits)

Section titled “Commit Message Hooks (Conventional Commits)”

Branch commits are validated locally by a commit-msg hook. The standards repo ships templates for the two common hook managers; setup.sh prints the install commands but never installs a hook manager for you:

Terminal window
# husky (v9+)
npx husky init # once, if .husky/ does not exist yet
cp .standards/templates/husky-commit-msg.example .husky/commit-msg
chmod +x .husky/commit-msg
# lefthook
cp .standards/templates/lefthook.yml.example lefthook.yml # or merge the blocks into yours
lefthook install

Both call .standards/scripts/check-commit-message.sh --file <msg>, which enforces <type>(<scope>): <subject> plus the optional commits.scopes allow-list from .standards.yml. make doctor recognises lefthook.yml and .husky/ as hook managers and warns when no commit-msg hook is configured.

Because lefthook and husky take over core.hooksPath, the native .git/hooks/post-merge reminder above stops running once they are installed — the lefthook template includes a post-merge block that restores it.

The same applies to the pre-commit worktree guard (templates/pre-commit-worktree-guard.example), which refuses a commit that stages a path under the agent worktree root (worktree_dir: in .standards.yml, default .claude/worktrees) — the way a worktree ends up committed as a submodule. setup.sh installs it as .git/hooks/pre-commit when no pre-commit hook exists; the lefthook template carries a pre-commit block for it, and husky users append sh .standards/templates/pre-commit-worktree-guard.example to .husky/pre-commit.

With squash-merge, GitHub writes the PR title as the mainline commit subject, so hooks on branch commits do not protect history. The standards-review action checks the PR title on every pull request and fails by default:

- name: Run standards review
uses: ./.standards/.github/actions/standards-review
with:
pr-title-check: fail # fail (default) | warn | off

The same action also narrows the conventional-commits lint module to the PR’s own commits (origin/<base>..HEAD) unless .standards.yml sets commits.since; a configured commits.window applies only when no range is available, so it never widens a PR check to unrelated mainline history.

One run of the action covers the whole repository: lint-standards.sh iterates the root plus every member (members: in the root .standards.yml, or auto-discovered */.standards.yml) and aggregates the results, so a workflow no longer needs one linter invocation per sub-root. The PR comment names the members and prefixes each member’s checks with its path (server: python/banned-functions). With changed-only: true the changed-file scope is re-based onto each member. See Monorepos: Members.

Run the sync script at any time to pull the latest standards and update all agent configuration files:

Terminal window
make sync-standards
# or
.standards/scripts/sync-standards.sh

After syncing, restart your editor to pick up the new configuration.

Standards Repository (new commit pushed)
|
v
Project Repositories
|
+-- Git hook detects update --> prints reminder
+-- CI/CD job checks --> fails PR if outdated
+-- Manual sync --> make sync-standards
+-- Scheduled workflow --> auto-updates weekly
|
v
Agent config files updated (.cursorrules, .aiderrc, etc.)
|
v
Restart editor --> new rules active
  • Check on every PR. A failing standards check is the easiest way to prevent drift.
  • Pin to versions in production projects. Use git checkout v1.x.x inside the submodule so updates are intentional.
  • Automate notifications. Post in Slack or Discord when the scheduled update workflow pushes a new commit.
  • Test first. Try new standards in a test project before rolling them out to all repositories.