Skip to content

Conversation

@Urgau
Copy link
Member

@Urgau Urgau commented Sep 2, 2025

This PR adds a way to do mentions of content changes (instead of just filename changes).

[mentions."#[rustc_attr]"]
type = "content"
message = "This is a message."
cc = ["@someone"]

Fixes #1851

@Urgau Urgau requested a review from Kobzol September 2, 2025 17:12
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Freel free to merge with/without including the filepaths

View changes since this review

@Urgau Urgau requested a review from Kobzol September 2, 2025 21:37
None => write!(result, "Some changes occurred in {to_mention}").unwrap(),
None => match type_ {
MentionsEntryType::Filename => {
write!(result, "Some changes occurred in {entry}").unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we don't actually use the relevant file paths for the filename. But I guess it doesn't hurt to collect them.

@Urgau Urgau added this pull request to the merge queue Sep 3, 2025
Merged via the queue into rust-lang:master with commit 346ecd6 Sep 3, 2025
3 checks passed
@Urgau Urgau deleted the mentions-content-changes branch September 3, 2025 16:30
@RalfJung
Copy link
Member

RalfJung commented Sep 3, 2025

Amazing, thanks :)

When can we start using this in rust-lang/rust?

@Urgau
Copy link
Member Author

Urgau commented Sep 3, 2025

We don't have a staging environment, so starting from when it was merged.

fn patch_contains(patch: &str, needle: &str) -> bool {
for line in patch.lines() {
if (!line.starts_with("+++") && line.starts_with('+'))
|| (!line.starts_with("---") && line.starts_with('-'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should trigger a mention when the text is removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed that above in #2171 (comment) and considered that removal might also be important. We can change that if you prefer since you're the only user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know when you'd care about deletions. Additions is what I proposed originally. At least for the attributes I have in mind for this, removing them requires no extra care (beyond the things CI already ensures).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't changes also count as a removal + addition?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so they would still cause a ping even if we just scan + lines, which seems like reasonable behavior to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #2176 to change the behavior.

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.

Automatic ping when certain patterns occur in the diff?

4 participants