Skip to content

Improve git commit/branch validation - #1261

Merged
amilcarlucas merged 1 commit into
masterfrom
branch_lint
Feb 9, 2026
Merged

Improve git commit/branch validation#1261
amilcarlucas merged 1 commit into
masterfrom
branch_lint

Conversation

@amilcarlucas

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 5, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread .github/workflows/test_branch_conventions.yml Outdated
Comment thread .github/workflows/test_branch_conventions.yml Outdated
Comment thread .github/workflows/test_branch_conventions.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +69 to +77
# 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."

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment thread .github/workflows/test_branch_conventions.yml Outdated
Comment thread .github/workflows/test_branch_conventions.yml Outdated

Copilot AI commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

@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.

@amilcarlucas
amilcarlucas merged commit d6e400d into master Feb 9, 2026
6 checks passed
@amilcarlucas
amilcarlucas deleted the branch_lint branch February 9, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants