fix(ci): enforce strict conventional commits validation #89
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.
Problem
The PR title validation workflow was not properly enforcing the Conventional Commits specification, allowing non-compliant titles to pass validation. This allowed malformed commit messages to enter the repository's release notes and automated changelog.
Issues Found
The regex pattern had several critical flaws that accepted invalid PR titles:
1. Single-character descriptions
2. Multiple spaces after colon
3. Scopes with spaces or special characters
4. Uppercase in descriptions or scopes
Solution
Updated Regex Pattern
Before:
After:
Key improvements:
\([a-z0-9_/-]+\)- Scope limited to lowercase alphanumeric with hyphens, underscores, and slashes:- Exactly one space required after colon (not multiple)[a-z].{2,}- Description must start with lowercase letter and be at least 3 characters total$- Anchors pattern at end to prevent trailing invalid contentEnhanced Error Messages
Added detailed requirements and common mistakes to help contributors fix validation failures:
Testing
Created comprehensive test suite (
test-pr-title-validation.sh) with 35 test cases:Documentation
CONTRIBUTING.mdwith explicit requirements and common mistakes sectionPR_VALIDATION_FIX_SUMMARY.mdwith detailed before/after comparisonsImpact
Valid Examples
All of these correctly pass validation:
Invalid Examples
All of these correctly fail validation:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.