Skip to content

ci: enforce conventional commits format for PR titles [skip buildkite] - #7513

Merged
rfay merged 8 commits into
ddev:mainfrom
rfay:20250805_rfay_standard_commit_messages
Aug 6, 2025
Merged

rfay merged 8 commits into
ddev:mainfrom
rfay:20250805_rfay_standard_commit_messages

Conversation

@rfay

@rfay rfay commented Aug 5, 2025 •

Copy link
Copy Markdown
Member

The Issue

  • PR titles currently use a custom format that doesn't align with conventional commits standard
  • Missing support for optional scopes like feat(pantheon): description
  • Limited commit types compared to conventional commits specification
  • Developer documentation doesn't reflect the conventional commits format

How This Commit Solves The Issue

  • Updates GitHub workflow regex pattern to support conventional commits with optional scopes
  • Adds missing commit types: chore, perf, style
  • Updates developer documentation with conventional commits examples and format
  • Adds PR title guidelines to CLAUDE.md for AI-assisted development consistency

Implementation Details

  • Modified .github/workflows/pr-check.yml regex from custom pattern to conventional commits pattern
  • Updated docs/content/developers/building-contributing.md with new format, examples, and commit types
  • Added PR title section to CLAUDE.md with format specification and examples
  • Added commit message strategy for first commits in PR series to follow PR template structure

🤖 Generated with Claude Code


https://regex101.com/r/9HTbYi/6

^(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\([a-z][a-z0-9-]*\))?!?:\s(?!.*  )[a-z](?:[ \w.''"`\\\/\-\(\)\[\],])*[A-Za-z0-9\]\)''"`](?:, (?:fixes|for) #\d+)*$
## ✅ Happy Cases (should pass)

### Basic formats
ci(pr): testing pr-checker.yml
feat: add something [skip ci]
feat: add something (extra)
fix: correct the bug
docs(readme): update installation guide
feat: add new_feature to enhance parsing logic
feat: allow multi-sections in configuration files
fix: handle edge_case with underscores
perf: optimize data-loading-speed
style: fix indentation_issues
test(api): add unit-tests for feature_x
ci(pr): testing pr-checker.yml
feat: handle `'quoted'` terms correctly
feat: support `"double-quoted"` values in config
docs: clarify use of `backticks` in examples
chore(deps): bump "mutagen"
chore(deps): bump `docker-compose`
chore(deps): bump 'docker'
chore(deps): bump "mutagen", `docker-compose`, 'docker', for #123
fix: allow .DS_Store when doing ddev composer create-project [skip ci]
refactor: use `compose-spec/compose-go/v2` for `fixupComposeYaml`
docs: add `.wslconfig` example

### With scope
feat(ui): add button component
fix(auth): handle token expiration
chore(deps): update dependencies to latest
docs(api-docs): improve examples with multi-part keys
feat(parser): allow '`' character in identifiers
fix(format): handle `'apostrophe` edge-cases
style(code): clean up `"double quoted"` formatting

### With breaking change
refactor!: drop support for Node 12
chore(deps)!: update major version
perf(core)!: overhaul caching mechanism

### With fixes/for references
fix: handle null case, fixes #123
feat: implement feature, for #456
docs: update examples, fixes #123, for #456
fix: resolve issue, for #789, fixes #101
fix(api): patch race condition, fixes #234
feat(storage): add multi-region support, for #567
ci: use `skip-package-name-checks`, pin `golangci-lint` to v2.2.1, remove `only-new-issues`, for #7415

### Mixed case messages
feat: add something Important
fix: handle Special Cases
feat: enable feature-request handling
fix: correct multi_section parsing
feat: handle `'Mixed Quoting'` inside message

## ❌ Invalid Cases (should fail)

### Type errors
FEAT: add something
feature: new stuff
: missing type

### Scope errors
feat(UI): component
fix(123): invalid
feat(scope!): invalid

### Description errors
feat: Add something
fix: 123 numbers first
docs: 
refactor!!: drop support for Node 12
fix: _starts_with_underscore
feat: ends-with-hyphen-
fix: ends_with_underscore_
feat: multiple  spaces  inside
fix: trailing space 

### Reference format errors
feat: something, Fixes #123
fix: something, fixes#123
docs: something, fixes #abc
fix: something fixes #123
feat: something, for #123, fixes
feat: something, fixes #123, , for #456
feat: something, fixes #, for #456
feat: something, fixes #123, for #
feat: something, fixes #123, for 456

### Structural errors
feat:missing space
feat(some-scope!invalid): description
fix(scope): , fixes #123
fix(scope): fixes #123,
feat(scope): invalid_char$

### Multiple issues
feat: something, fixes #123 fixes #456
feat: something, fixes #123,for #456
feat: something, fixes #123, fixes 456
feat: something, fixes #123,, for #456

rfay and others added 3 commits August 5, 2025 15:59
## The Issue
- PR titles currently use a custom format that doesn't align with conventional commits standard
- Missing support for optional scopes like feat(pantheon): description
- Limited commit types compared to conventional commits specification
- Developer documentation doesn't reflect the conventional commits format

## How This Commit Solves The Issue
- Updates GitHub workflow regex pattern to support conventional commits with optional scopes
- Adds missing commit types: chore, perf, style
- Updates developer documentation with conventional commits examples and format
- Adds PR title guidelines to CLAUDE.md for AI-assisted development consistency

## Implementation Details
- Modified .github/workflows/pr-check.yml regex from custom pattern to conventional commits pattern
- Updated docs/content/developers/building-contributing.md with new format, examples, and commit types
- Added PR title section to CLAUDE.md with format specification and examples
- Added commit message strategy for first commits in PR series to follow PR template structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Remove literal template structure that might be causing Claude Code
to include PR template content in commit messages
Remove non-greedy quantifier that was causing validation failures
for valid conventional commit titles with scopes containing hyphens
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown

@rfay rfay changed the title ci(pr-title): enforce conventional commits format for PR titles ci: enforce conventional commits format for PR titles Aug 5, 2025
@rfay
rfay marked this pull request as ready for review August 5, 2025 22:16
@rfay
rfay requested review from a team as code owners August 5, 2025 22:16
@rfay
rfay requested a review from stasadev August 5, 2025 22:17
@rfay

rfay commented Aug 5, 2025

Copy link
Copy Markdown
Member Author

Can't use the new format until this goes in.

@rfay rfay changed the title ci: enforce conventional commits format for PR titles ci: enforce conventional commits format for PR titles [skip buildkite] Aug 6, 2025

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

About , fixes #number - the regex doesn't really check for it, I tested these on https://regex101.com/

feat: add feature, Fixes #test
feat: add feature fixes #123
feat: add feature, fixes #

And they all pass.

Comment thread .github/workflows/pr-check.yml Resolved
Co-authored-by: Stanislav Zhuk <[email protected]>
@rfay

rfay commented Aug 6, 2025

Copy link
Copy Markdown
Member Author

Do you think we should check for fixes ? We don't always have something.

@stasadev

stasadev commented Aug 6, 2025

Copy link
Copy Markdown
Member

I don't think there should be a strict requirement for "fixes".

I'm just saying that having it in a regular expression doesn't give us anything, because it's a totally optional match for that.

@rfay

rfay commented Aug 6, 2025

Copy link
Copy Markdown
Member Author

Feel free to push anything you prefer, thanks!

@stasadev
stasadev force-pushed the 20250805_rfay_standard_commit_messages branch from 20c6ea0 to a4e831b Compare August 6, 2025 17:55
@stasadev
stasadev force-pushed the 20250805_rfay_standard_commit_messages branch from a4e831b to 6f6a22f Compare August 6, 2025 18:07

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I updated OP with a link to regex, so it's easy to check new cases.

And tested everything in:

@rfay
rfay merged commit 664e862 into ddev:main Aug 6, 2025
@rfay
rfay deleted the 20250805_rfay_standard_commit_messages branch August 6, 2025 20:25
stasadev added a commit to stasadev/ddev that referenced this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants