-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: handle multiple commits in a single message #2358
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
61939a8
to
736a363
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this and sorry for the delay in reviewing.
For the splitting commit messages, this seems ok to me -- we're splitting on a newline and then the next line looks like a conventional commit message. The scenario we're intentionally trying to avoid is GitHub's default squash/merge message where incremental commit messages might be parsed which we don't want (example: https://github.com/googleapis/release-please/blob/main/test/fixtures/commit-messages/1257-breaking-change.txt). It seems this feature still ignores the subcommit messages because the next line doesn't start with the conventional commit looking message.
For the additional breaking change detection, please split it into a separate PR and add a test for it. Additionally, the current breaking change detection is handled by the conventional-commits/parser library which uses a grammar to actually conform to the conventionalcommits.org spec. I'm not sure we want to add this additional way of marking a breaking change.
Hi @chingor13, thanks for the review. I want to clarify the necessity of including the breaking change detection lines in
From my understanding, the library you mentioned is not capable of detecting breaking changes in the body of the commit out of the box. If it were, I would expect the tests to pass without the additional checks. By including these lines, I ensure that the tests pass and that the changelog accurately reflects the intended breaking changes, thus maintaining the integrity of the commit parsing process and stay backward compatible. I would be happy to try out any ideas you might have to keep the scope of this PR limited to the splitting of the commit messages, without including any breaking change detection. If you have any suggestions on how to accomplish this without affecting the breaking change logic, I would appreciate your input. |
8f21f41
to
e650ec7
Compare
- updated `splitMessages` function to handle multiple conventional commits within the main message - added logic to separate conventional commits (feat, fix, docs, etc.) within the main message - preserved the original message structure outside of nested commit blocks - enhanced breaking change detection from commit body in `toConventionalChangelogFormat` and `postProcessCommits` functions Resolves googleapis#2357
- added new test cases for parsing multiple commits from a single message - added fixture file for multiple commits in a single message - changed the order of the expected commits in `multiple-messages` and `1257-breaking-change` fixtures since the order of the commits in the is not reversed anymore
e650ec7
to
d39e3fb
Compare
Summary
This PR enhances the breaking change detection mechanism and improves the parsing of commit messages to handle multiple conventional commits and nested commit blocks mentioned in #2357
Changes
toConventionalChangelogFormat
andpostProcessCommits
functions.splitMessages
function to:BEGIN_NESTED_COMMIT
/END_NESTED_COMMIT
blocks.test/commits.ts
to reflect the changes and added new test cases for multiple commits in a single message.multiple-commits-single-message.txt
for testing multiple commits in a single message.Additional Notes
splitMessages
function now correctly handles and separates multiple conventional commits and nested commit blocks, improving the accuracy of commit parsing.Fixes #2357