-
Notifications
You must be signed in to change notification settings - Fork 132
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: add NESTED_COMMIT markers when combining multiple source commits #4426
Conversation
…g multiple source commits
Do not merge until after #4427 is deployed |
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.
Please add a flag to enable this new behavior.
Do the delimiters get added when a PR contains only a single commit?
packages/owl-bot/src/create-pr.ts
Outdated
.join(NESTED_COMMIT_SEPARATOR)}`; | ||
|
||
// prepend the new commit message and use original title truncation logic | ||
return resplit( |
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.
Why not call prependCommitMessage before calling resplit? Then resplit gets called only once and the unsplitting logic in this function can be removed.
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.
The title/first line splitting deals with the PR title limitation of 256 characters. If the previous commit was >256 characters, then the message uses the ellipses to split the message. We do want to rejoin that previous message to be nicer for the release notes.
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.
We do want to rejoin that previous message to be nicer for the release notes.
Indeed, so why not call this function on the original message (before resplit)?
@SurferJeffAtGoogle I'm unsure how we want to opt-in this functionality. In code, I added an enum that is surfaced as a CLI argument, but I'm unsure how we want to configure an opt-in for a repository. |
The CLI argument looks great! |
Do the delimiters get added when a PR contains only a single commit? |
No, they are only added when we append to an existing PR |
packages/owl-bot/src/copy-code.ts
Outdated
WithRegenerateCheckbox.Yes | ||
const {title, body} = prependCommitMessage( | ||
commitBody, | ||
{title: pull.title, body: pull.body || ''}, |
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.
Nit: the typescript idiom is pull.body ?? ''
.
/gcbrun |
/gcbrun |
2 similar comments
/gcbrun |
/gcbrun |
@SurferJeffAtGoogle @chingor13 This still doesn't seem to be working on the Java monorepo. Do we need to add any config? |
In googleapis/release-please#1566, we added the ability to explicitly denote multiple commit messages by using
BEGIN_NESTED_COMMIT
/END_NESTED_COMMIT
markers.This PR now augments owl-bot to include those markers when combining multiple copy-code runs in a single PR. We add a new
prependCommitMessage
helper that encapsulates the logic of recombining a previous owl-bot copy PR, wrapping the previous message in aBEGIN/END_NESTED_COMMIT
block and pre-pending the new commit message.Note that any existing PR bodies will be grouped together into a single nested commit when the next copy code commit is added.
Fixes #3342