ci: enforce branch model, conventional commits, and no-AI-files policy#340
Open
ss-o wants to merge 1 commit into
Open
ci: enforce branch model, conventional commits, and no-AI-files policy#340ss-o wants to merge 1 commit into
ss-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). |
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.