Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 12, 2025

Problem

The PR title validation workflow was not strict enough in enforcing the Conventional Commits specification. It incorrectly accepted malformed PR titles that violate the guidelines documented in CONTRIBUTING.md.

Issues Fixed

1. Malformed Scopes

The original pattern used (\(.+\))? for scope validation, where .+ matches ANY character including closing parentheses. This allowed invalid scopes:

fix(scope)):    ✅ incorrectly accepted (double closing paren)
fix(sc)ope):    ✅ incorrectly accepted (nested paren)

2. Capitalized Descriptions

The original pattern used : .{1,} for description validation, which allowed any character to start the description. This violated the CONTRIBUTING.md guideline to "use lowercase for type and description":

fix: Add feature    ✅ incorrectly accepted
fix: Something      ✅ incorrectly accepted

Solution

Updated the regex pattern in .github/workflows/validate-commits.yml:

- PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?: .{1,}'
+ PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9/_-]+\))?!?: [a-z].+'

Changes:

  • Scope validation: (\([a-z0-9/_-]+\))? now only accepts lowercase letters, numbers, hyphens, underscores, and forward slashes
  • Description validation: [a-z].+ now requires the description to start with a lowercase letter

Impact

✅ All valid PR titles remain accepted (backward compatible)
✅ Malformed scopes are now properly rejected
✅ Capitalized descriptions are now properly rejected
✅ Strict enforcement of Conventional Commits spec
✅ Aligns with CONTRIBUTING.md guidelines

Examples

Valid PR titles (still accepted):

feat: add new feature
fix(mqtt): handle crash
feat!: breaking change
fix(api/v2): update endpoint

Invalid PR titles (now properly rejected):

Fix bla bla          ❌ capitalized type
fix: Add feature     ❌ capitalized description
fix(scope)):         ❌ malformed scope
fix(sc)ope):         ❌ nested parenthesis in scope

This ensures PR titles strictly follow the Conventional Commits specification, which is important for automated changelog generation and project maintainability.

Original prompt

Fix commit name check for pr - only change validate-commits.yml. now it allows nonconventional commits like "Fix bla bla".


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix commit name check for pull requests ci: fix PR title validation to enforce strict conventional commits format Oct 12, 2025
Copilot AI requested a review from cziter15 October 12, 2025 23:49
@cziter15 cziter15 changed the title ci: fix PR title validation to enforce strict conventional commits format cit: fix PR title validation to enforce strict conventional commits format Oct 13, 2025
@cziter15 cziter15 changed the title cit: fix PR title validation to enforce strict conventional commits format ci: fix PR title validation to enforce strict conventional commits format Oct 13, 2025
@cziter15 cziter15 marked this pull request as ready for review October 13, 2025 05:50
Copilot AI review requested due to automatic review settings October 13, 2025 05:50
Copy link
Contributor

Copilot AI left a comment

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 fixes the PR title validation workflow to enforce stricter adherence to the Conventional Commits specification by updating the regex pattern to reject malformed scopes and capitalized descriptions.

  • Updated regex pattern to restrict scope characters to lowercase letters, numbers, hyphens, underscores, and forward slashes
  • Changed description validation to require starting with a lowercase letter
  • Enhanced workflow trigger and added detailed comments explaining the pattern requirements

@cziter15 cziter15 changed the title ci: fix PR title validation to enforce strict conventional commits format cfi: fix PR title validation to enforce strict conventional commits format Oct 13, 2025
@cziter15 cziter15 changed the title cfi: fix PR title validation to enforce strict conventional commits format ci: fix PR title validation to enforce strict conventional commits format Oct 13, 2025
@cziter15 cziter15 merged commit 21462af into master Oct 13, 2025
5 of 6 checks passed
@cziter15 cziter15 deleted the copilot/fix-commit-name-check branch October 13, 2025 06:02
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.

2 participants