ci: automate PR title linting - #229
Conversation
This will help with Squash & Merge when you need the squashed commit to have the correct Conventional Commits format so that it can be parsed when generating release notes (With Squash & Merge the squashed commit message is taken from the PR title)
|
I like the idea! However, could we simplify the approch with a simple script, as does Vite in its Git hooks? const RELEASE_RE = /^v\d/
const COMMIT_RE =
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore)(\(.+\))?!?: .{1,50}/
if (!RELEASE_RE.test(msg) && !COMMIT_RE.test(msg)) {
console.log()
console.error(
` ${colors.bgRed(colors.white(' ERROR '))} ${colors.red(
'invalid commit message format.',
)}\n\n${colors.red(
' Proper commit message format is required for automated changelog generation. Examples:\n\n',
)} ${colors.green('feat: add `comments` option')}\n` +
` ${colors.green(
'fix: handle events on blur (close #28)',
)}\n\n${colors.red(
' See .github/commit-convention.md for more details.\n',
)}`,
)
process.exit(1)
}I'd much prefer the most simplest solution instead of new dependencies. |
I would agree with you, but in my opinion it is better to use Firstly it does not add any dependencies to the project except simple types for config, and |
|
Thanks for the explanation, I see your point. I agree, let's use |
This will help with Squash & Merge when you need the squashed commit to have the correct Conventional Commits format so that it can be parsed when generating release notes
(With Squash & Merge the squashed commit message is taken from the PR title)