-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix: handle cargo milestone update for PR from GitHub merge queue #1861
Conversation
.filter(|commit| | ||
// Assumptions: | ||
// * A merge commit always has two parent commits. | ||
// * Cargo's PR never got merged as fast-forward / rebase / squash merge. | ||
commit.parents.len() == 2) |
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.
While the regex below has been proved working, this filter hasn't. This may not be necessary. I added because for preventive purpose.
src/handlers/milestone_prs.rs
Outdated
commit.commit.message.len() | ||
); | ||
|
||
merge_re.captures(&commit.commit.message).map(|cap| { |
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.
I'm wondering, would it be a good idea to only look at the first line of the commit message? I'm wondering what would happen if there is a stray mention of another issue/PR in the body somewhere, like:
fix(fix): Migrate cargo script manifests across editions (#14864)
This is a multi-line description
that happens to mention an issue (#1234)
somewhere in its text.
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.
Looking at this closer, this regex doesn't seem to work with a multi-line commit message. For example:
Improve error handling when PathSource is relative (#14854)
When editing dependencies with cargo, if a relative PathSource is
supplied cargo panics with "both paths are absolute". This is the
opposite of what's actually wrong leading to confusion.
Instead, use the same error formatting we use in other diff_paths calls
and return that error instead of panicking.
This is not matching here, since the $
requires the (#14854)
to be at the end of the message (since regex does not have mutliline enabled by default).
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.
Hah! I overlooked that difference. Thanks for investigating I'll update to check the first line only then.
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.
Addressed in 7229b2a!
Cargo has migrated to GitHub merge queue: rust-lang/cargo#14718 The regex doesn't work for merge commit made by GitHub merge queue. This PR adds extra regex pattern to capture that. This regex has been proved working locally. See <ehuss/cargo-new-release#2>
b98a33a
to
7cf03cd
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! I pushed a small change to remove a panic if the commit message is empty. Although unlikely (or impossible?) to happen, I didn't feel comfortable crashing triagebot if it does.
Although this is unlikely (or impossible?) to ever happen in practice, I don't feel comfortable with crashing triagebot if it ever happens.
10e5a94
to
6015826
Compare
Cargo has migrated to GitHub merge queue:
rust-lang/cargo#14718
The regex doesn't work for merge commit made by GitHub merge queue.
This PR adds extra regex pattern to capture that.
This regex has been proved working locally.
See ehuss/cargo-new-release#2
cc @ehuss