@@ -7,12 +7,19 @@ use crate::{config::IssueLinksConfig, github::GithubCommit};
77static LINKED_RE : LazyLock < Regex > =
88 LazyLock :: new ( || Regex :: new ( r"( |^)([a-zA-Z-_]+/[a-zA-Z-_]+)?(#[0-9]+)\b" ) . unwrap ( ) ) ;
99
10+ const MERGE_IGNORE_LIST : [ & str ; 2 ] = [ "Rollup merge of " , "Auto merge of " ] ;
11+
1012pub ( super ) fn issue_links_in_commits (
1113 _conf : & IssueLinksConfig ,
1214 commits : & [ GithubCommit ] ,
1315) -> Option < String > {
1416 let issue_links_commits = commits
1517 . into_iter ( )
18+ . filter ( |c| {
19+ !MERGE_IGNORE_LIST
20+ . iter ( )
21+ . any ( |i| c. commit . message . starts_with ( i) )
22+ } )
1623 . filter ( |c| LINKED_RE . is_match ( & c. commit . message ) )
1724 . map ( |c| format ! ( " - {}\n " , c. sha) )
1825 . collect :: < String > ( ) ;
@@ -41,6 +48,17 @@ fn test_mentions_in_commits() {
4148
4249 assert_eq ! ( issue_links_in_commits( & config, & commits) , None ) ;
4350
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+
4462 commits. push ( dummy_commit_from_body (
4563 "d7daa17bc97df9377640b0d33cbd0bbeed703c3a" ,
4664 "This is a body with a issue link #123." ,
0 commit comments