Skip to content

feat: CI safeguards – gate job, auto-merge, pre-commit enforcement#199

Merged
typelicious merged 1 commit into
mainfrom
feat/ci-safeguards
Apr 4, 2026
Merged

feat: CI safeguards – gate job, auto-merge, pre-commit enforcement#199
typelicious merged 1 commit into
mainfrom
feat/ci-safeguards

Conversation

@typelicious
Copy link
Copy Markdown
Collaborator

Summary

  • pre-commit validate-config step in ci.yml lint job — catches hook ID typos before they silently disable hooks
  • CI Gate job — single required status check that depends on test + lint + package with if: always(); stable through job renames
  • automerge.yml — enables GitHub's native auto-merge on every non-draft PR; merges automatically when gate passes
  • CONTRIBUTING.mdpre-commit install documented as required setup step
  • docs/process/ci-safeguards.md — full documentation of the three mechanisms

Next manual step

In repo Settings → Branches → Branch protection for main:

  1. Add CI Gate as the required status check
  2. Uncheck "Allow administrators to bypass branch protection rules"
  3. Enable "Allow auto-merge" in Settings → General

Test plan

  • CI Gate job appears in checks after merge
  • Add CI Gate as required check in branch protection
  • Open a test PR → verify auto-merge enables automatically
  • Break a check → verify PR stays open

🤖 Generated with Claude Code

…ement

Three complementary mechanisms to prevent "merge and fix later" cycles:

1. pre-commit install enforcement
   - Added `pre-commit install` to CONTRIBUTING.md setup (required step)
   - ci.yml: added `pre-commit validate-config` step before hook run — catches
     typos in hook IDs (e.g. check-merge-conflicts vs check-merge-conflict)
     before they silently disable entire hook groups

2. CI Gate job (ci.yml)
   - New `gate` job with `if: always()` depending on test + lint + package
   - Single required status check for branch protection; stable even when jobs
     are renamed — only update `needs:` in the workflow, not GitHub settings
   - With "Allow administrators to bypass" unchecked in branch protection,
     gh pr merge --admin no longer bypasses lint/test failures

3. Auto-merge bot (.github/workflows/automerge.yml)
   - Enables GitHub's native auto-merge (squash) on every non-draft PR
   - GitHub merges automatically when CI Gate passes — no manual merge step
   - Requires "Allow auto-merge" enabled in repo Settings → General

Documentation: docs/process/ci-safeguards.md (new)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@typelicious typelicious merged commit 0971385 into main Apr 4, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant