@@ -7,12 +7,19 @@ use crate::{config::IssueLinksConfig, github::GithubCommit};
7
7
static LINKED_RE : LazyLock < Regex > =
8
8
LazyLock :: new ( || Regex :: new ( r"( |^)([a-zA-Z-_]+/[a-zA-Z-_]+)?(#[0-9]+)\b" ) . unwrap ( ) ) ;
9
9
10
+ const MERGE_IGNORE_LIST : [ & str ; 2 ] = [ "Rollup merge of " , "Auto merge of " ] ;
11
+
10
12
pub ( super ) fn issue_links_in_commits (
11
13
_conf : & IssueLinksConfig ,
12
14
commits : & [ GithubCommit ] ,
13
15
) -> Option < String > {
14
16
let issue_links_commits = commits
15
17
. into_iter ( )
18
+ . filter ( |c| {
19
+ !MERGE_IGNORE_LIST
20
+ . iter ( )
21
+ . any ( |i| c. commit . message . starts_with ( i) )
22
+ } )
16
23
. filter ( |c| LINKED_RE . is_match ( & c. commit . message ) )
17
24
. map ( |c| format ! ( " - {}\n " , c. sha) )
18
25
. collect :: < String > ( ) ;
@@ -41,6 +48,17 @@ fn test_mentions_in_commits() {
41
48
42
49
assert_eq ! ( issue_links_in_commits( & config, & commits) , None ) ;
43
50
51
+ commits. push ( dummy_commit_from_body (
52
+ "86176475acda9c775f844f5ad2470f05aebd4249" ,
53
+ "Rollup merge of #123\n \n We ignore the issue link for Rollup merge of" ,
54
+ ) ) ;
55
+ commits. push ( dummy_commit_from_body (
56
+ "8009423d53d30b56d8cf0fec08f9852329a1a9a4" ,
57
+ "Auto merge of #123\n \n We ignore the issue link for Auto merge of" ,
58
+ ) ) ;
59
+
60
+ assert_eq ! ( issue_links_in_commits( & config, & commits) , None ) ;
61
+
44
62
commits. push ( dummy_commit_from_body (
45
63
"d7daa17bc97df9377640b0d33cbd0bbeed703c3a" ,
46
64
"This is a body with a issue link #123." ,
0 commit comments