Skip to content

ci: enforce branch model, conventional commits, and no-AI-files policy#340

Open
ss-o wants to merge 1 commit into
nextfrom
ci/repo-governance
Open

ci: enforce branch model, conventional commits, and no-AI-files policy#340
ss-o wants to merge 1 commit into
nextfrom
ci/repo-governance

Conversation

@ss-o
Copy link
Copy Markdown
Member

@ss-o ss-o commented May 16, 2026

What this does

Applies the full repository governance setup to keep zi's history clean, professional, and contributor-friendly.

Changes

File What changed
.github/copilot-instructions.md New — Copilot config: commit format, branch model, no AI co-author trailers, no AI config files
.github/workflows/commit-lint.yml New — CI that validates conventional commits, blocks AI co-author trailers, checks PR title and branch name
.github/workflows/trunk-check.yml Run Trunk on next branch as well as main
.github/PULL_REQUEST_TEMPLATE.md Rewritten with branch model guidance and updated checklist
docs/CONTRIBUTING.md Full branch model diagram, commit convention guide, no-AI-files list
.gitignore Added AI assistant config file patterns

Branch/ruleset protection (applied via API)

  • main: require PR + 1 review + CODEOWNER review, require Trunk + Zsh + commit-lint checks, linear history, no force-push, no direct push, dismiss stale reviews
  • next: require PR + 1 review, require Trunk + commit-lint checks, linear history, no force-push
  • Repo settings: merge commits disabled (squash or rebase only), auto-delete branches on merge
  • Rulesets: main — release gate and next — integration gate enforce conventional commit message pattern at the push layer

Commit guidelines enforced

type(scope): short description   ≤72 chars, imperative mood
Types: feat  fix  perf  refactor  docs  test  ci  chore  revert

No AI co-author trailers (Co-authored-by: Copilot, Co-authored-by: Claude, etc.) are blocked by the commit-lint workflow.

- Add .github/copilot-instructions.md with commit format rules,
  branch model documentation, and prohibition on AI co-author trailers
  or AI config files (AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules…)

- Add .github/workflows/commit-lint.yml: PR workflow that validates
  conventional commit subject format, blocks AI co-author trailers,
  checks PR title format, and enforces branch naming convention

- Update .github/workflows/trunk-check.yml: run Trunk on next branch
  in addition to main to catch issues before integration

- Update .github/PULL_REQUEST_TEMPLATE.md: document the branch model
  (branch from next, PR to next, next→main for releases) and add
  checklist items for commit hygiene

- Update docs/CONTRIBUTING.md: full branch model diagram, commit
  message guide, and explicit list of files not to add to the repo

- Update .gitignore: add AI assistant config file patterns
Copilot AI review requested due to automatic review settings May 16, 2026 00:42
@ss-o ss-o requested a review from a team as a code owner May 16, 2026 00:42
@ss-o ss-o added the ci 🤖 label May 16, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds repository governance/CI guardrails to enforce the branch model (next as integration), Conventional Commits, and a “no AI config files / no AI co-author trailers” policy.

Changes:

  • Add a new commit-lint workflow to validate commit subjects, PR titles, branch names, and block AI co-author trailers.
  • Expand Trunk CI to run on next branch pushes (in addition to main).
  • Update contributor-facing docs/templates and .gitignore to document/enforce the branch/commit model and AI-file exclusions.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/CONTRIBUTING.md Rewrites contributing guidelines with branch model + Conventional Commits + “what not to add”.
.gitignore Ignores common AI-assistant config files and restores .trunk/out* ignore entry formatting.
.github/workflows/trunk-check.yml Runs Trunk checks on pushes to main and next.
.github/workflows/commit-lint.yml Adds CI checks for Conventional Commits, PR title format, branch naming, and AI co-author trailers.
.github/PULL_REQUEST_TEMPLATE.md Updates PR template to reflect branch/commit rules and contributor checklist.
.github/copilot-instructions.md Adds Copilot-specific guidance aligned with the repo’s branch/commit/AIs policy.
Comments suppressed due to low confidence (1)

.github/workflows/commit-lint.yml:90

  • Same issue as the commit subject check: this PR title regex limits only the text after : to 72 characters, not the full title length, but the repo guidance says the subject/title line must be ≤72 total. This will allow titles longer than intended.
        run: |
          PATTERN='^(feat|fix|perf|refactor|docs|test|ci|chore|revert)(\([^)]+\))?!?: .{1,72}$'
          if ! echo "$PR_TITLE" | grep -qE "$PATTERN"; then
            echo "❌ PR title does not follow Conventional Commits format."
            echo "   Got:      $PR_TITLE"
            echo "   Expected: type(scope): short description"
            echo "   Types:    feat, fix, perf, refactor, docs, test, ci, chore, revert"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/CONTRIBUTING.md

Before starting significant work, [open an issue](https://github.com/z-shell/zi/issues/new/choose) to discuss the change.

See also the [community contributing guidelines](https://github.com/z-shell/community/blob/main/docs/CONTRIBUTING_GUIDELINES.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).
Comment on lines +31 to +33

CONVENTIONAL_PATTERN='^(feat|fix|perf|refactor|docs|test|ci|chore|revert)(\([^)]+\))?!?: .{1,72}$'
AI_COAUTHOR_PATTERN='Co-authored-by:.*[Cc]opilot|Co-authored-by:.*[Cc]laude|Co-authored-by:.*[Gg][Pp][Tt]|Co-authored-by:.*[Oo]pen[Aa][Ii]|Co-authored-by:.*[Gg]emini|Co-authored-by:.*[Cc]ursor'

while IFS= read -r sha; do
subject=$(git show -s --format='%s' "$sha")
body=$(git show -s --format='%b' "$sha")
- [ ] This PR targets the `next` branch
- [ ] Commit messages follow Conventional Commits format
- [ ] No AI co-author trailers in commit messages
- [ ] I have read [CONTRIBUTING.md](docs/CONTRIBUTING.md)
@ss-o ss-o removed the ci 🤖 label May 16, 2026
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.

2 participants