@@ -9,7 +9,10 @@ pub(super) fn mentions_in_commits(
9
9
) -> Option < String > {
10
10
let mentions_commits = commits
11
11
. into_iter ( )
12
- . filter ( |c| !parser:: get_mentions ( & c. commit . message ) . is_empty ( ) )
12
+ . filter ( |c| {
13
+ let mentions = parser:: get_mentions ( & c. commit . message ) ;
14
+ !mentions. is_empty ( ) && mentions. iter ( ) . any ( |m| * m != "rustbot" )
15
+ } )
13
16
. map ( |c| format ! ( "- {}\n " , c. sha) )
14
17
. collect :: < String > ( ) ;
15
18
44
47
45
48
assert_eq ! ( mentions_in_commits( & NoMentionsConfig { } , & commits) , None ) ;
46
49
50
+ commits. push ( dummy_commit_from_body (
51
+ "6565ffdd8af4ca0ec7c8faceee59c582edcd83b2" ,
52
+ "This is a body that only mentions @rustbot for a command!" ,
53
+ ) ) ;
54
+
55
+ assert_eq ! ( mentions_in_commits( & NoMentionsConfig { } , & commits) , None ) ;
56
+
57
+ commits. push ( dummy_commit_from_body (
58
+ "6565ffdd8af4ca0ec7c8faceee59c582edcd83b2" ,
59
+ "This is a body that mentions @rustbot for a command! And then a user @mention" ,
60
+ ) ) ;
61
+
62
+ assert_eq ! (
63
+ mentions_in_commits( & NoMentionsConfig { } , & commits) ,
64
+ Some (
65
+ r"There are username mentions (such as `@user`) in the commit messages of the following commits.
66
+ *Please remove the mentions to avoid spamming these users.*
67
+ - 6565ffdd8af4ca0ec7c8faceee59c582edcd83b2
68
+ " . to_string( )
69
+ )
70
+ ) ;
71
+
72
+ let _ = commits. pop ( ) ; // Remove that @rustbot & @mention case
73
+
47
74
commits. push ( dummy_commit_from_body (
48
75
"d7daa17bc97df9377640b0d33cbd0bbeed703c3a" ,
49
76
"This is a body with a @mention!" ,
0 commit comments