ci: enforce branch model, conventional commits, and no-AI-files policy#340
ci: enforce branch model, conventional commits, and no-AI-files policy#340ss-o wants to merge 1 commit into
Conversation
- 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
There was a problem hiding this comment.
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-lintworkflow to validate commit subjects, PR titles, branch names, and block AI co-author trailers. - Expand Trunk CI to run on
nextbranch pushes (in addition tomain). - Update contributor-facing docs/templates and
.gitignoreto 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.
|
|
||
| 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). |
|
|
||
| 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) |
|
Heads up: potential conflict with #348 PR #348 was opened from
Suggest merging whichever PR lands first (this one appears smaller in scope — governance only), then rebasing #348 on top of the merged commit to resolve conflicts before review. |
What this does
Applies the full repository governance setup to keep zi's history clean, professional, and contributor-friendly.
Changes
.github/copilot-instructions.md.github/workflows/commit-lint.yml.github/workflows/trunk-check.ymlnextbranch as well asmain.github/PULL_REQUEST_TEMPLATE.mddocs/CONTRIBUTING.md.gitignoreBranch/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 reviewsnext: require PR + 1 review, require Trunk + commit-lint checks, linear history, no force-pushmain — release gateandnext — integration gateenforce conventional commit message pattern at the push layerCommit guidelines enforced
No AI co-author trailers (
Co-authored-by: Copilot,Co-authored-by: Claude, etc.) are blocked by the commit-lint workflow.