Skip to content
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

Merged
merged 3 commits into from
Nov 30, 2024

Conversation

weihanglo
Copy link
Member

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

Comment on lines +155 to +159
.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)
Copy link
Member Author

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.

commit.commit.message.len()
);

merge_re.captures(&commit.commit.message).map(|cap| {
Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Member Author

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.

Copy link
Member Author

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>
Copy link
Contributor

@ehuss ehuss left a 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.
@ehuss ehuss merged commit 4b28086 into rust-lang:master Nov 30, 2024
2 checks passed
@weihanglo weihanglo deleted the milestone-cargo branch November 30, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants