Improve git commit/branch validation - #1261
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds two new validation checks to the GitHub Actions workflow that validates commit conventions. The checks enforce conventional commit format (requiring a colon in each commit message) and limit commit subject lines to 160 characters maximum.
Changes:
- Added validation to ensure commit messages follow conventional commits format (contain a colon)
- Added validation to ensure commit subject lines don't exceed 160 characters
8bc2cfb to
acd8854
Compare
| # require a ":" to appear somewhere in each commit message: | ||
| while IFS= read -r x; do | ||
| if [[ -z "$x" ]]; then continue; fi | ||
| if ! [[ "$x" == *":"* ]] ; then | ||
| echo "❌ Commit message ($x) does not follow conventional commits conventions" | ||
| exit 1 | ||
| fi | ||
| done <<< "$COMMITS" | ||
| echo "✅ Commit messages follow conventional commits conventions." |
There was a problem hiding this comment.
The conventional commits validation only checks for the presence of a colon anywhere in the commit message. This is too permissive and doesn't actually validate the conventional commits format. According to the conventional commits specification (https://www.conventionalcommits.org/), the format should be: type(optional scope): description where type must be a word (like feat, fix, docs, etc.).
This simple check would accept invalid messages like "this: is: not: valid" or even "some random: text". A more robust validation is already implemented in .github/workflows/build_windows_macos.yml at line 534 which uses the regex pattern ^(\w+)(\(.+\))?\s*!?\s*:\s*(.+)$. Consider using a similar approach here to properly validate the conventional commits format.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
|
@amilcarlucas I've opened a new pull request, #1265, to work on those changes. Once the pull request is ready, I'll request review from you. |
3b79fdc to
6f1ca61
Compare
6f1ca61 to
36e77d4
Compare
No description provided.