Enforcing Commit Message Standards¶
Version: Arctyk ITSM v0.6.0+
Last Updated: January 2026
This document explains how to ensure all pull requests follow the commit message conventions.
Overview¶
We use several mechanisms to enforce proper commit messages:
- GitHub PR Template - Reminds contributors of the commit guidelines
- commitlint - Automated validation in pull requests
- Pre-commit hooks - Local validation before pushing
- Branch protection rules - Enforce commit message validation
For Contributors¶
Setup Local Environment¶
Install pre-commit hooks to validate commits locally:
This will automatically validate your commit messages before they're created.
Before Pushing¶
Ensure your commits follow the format:
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat: add email notifications for ticket assignments
- Implement Celery task for sending emails
- Add email templates
- Update ticket assignment view
Closes #42
If Your Commits Don't Follow the Convention¶
If GitHub Actions rejects your commits, you can fix them:
Option 1: Rebase and squash (recommended for small PRs)
git rebase -i HEAD~N # N = number of commits to fix
# Change 'pick' to 'reword' for each commit
git push --force-with-lease
Option 2: Amend last commit
For Repository Maintainers¶
GitHub Actions Workflow¶
The commit-validation.yml workflow (in .github/workflows/):
- Runs on every pull request
- Validates all commit messages against the conventional commit format
- Blocks PR merge if validation fails
Branch Protection Rules¶
Configure in Settings → Branches → Branch protection rules:
-
Require status checks to pass:
-
✅ "Commit Message Validation"
- ✅ "Tests"
-
✅ "Linting"
-
Require branches to be up to date before merging
-
Require linear history (optional, keeps git history clean)
Commitlint Configuration¶
The commitlint.config.js file defines allowed types and rules. Modify it to match your conventions.
Troubleshooting¶
"commitlint: not found" locally¶
Install pre-commit hooks:
GitHub Actions failing but commits look correct¶
Check the workflow output - it may indicate:
- Subject ends with period (remove it)
- Type not in allowed list
- Subject starts with capital letter (should be lowercase)
Need to merge a PR with non-compliant commits¶
Squash and rebase on merge:
- GitHub PR page → "Squash and merge"
- Fix the commit message in the dialog to follow the convention
- Complete the merge