@@ -48,11 +48,13 @@ pub(super) async fn parse_input(
4848 return Ok ( None ) ;
4949 }
5050
51- // Don't trigger if the PR has any of the excluded labels.
52- for label in event. issue . labels ( ) {
53- if config. exclude_labels . contains ( & label. name ) {
54- return Ok ( None ) ;
55- }
51+ // Don't trigger if the PR has any of the excluded title segments.
52+ if config
53+ . exclude_titles
54+ . iter ( )
55+ . any ( |s| event. issue . title . contains ( s) )
56+ {
57+ return Ok ( None ) ;
5658 }
5759
5860 let mut merge_commits = HashSet :: new ( ) ;
@@ -70,12 +72,11 @@ pub(super) async fn parse_input(
7072 }
7173 }
7274
73- let input = NoMergesInput { merge_commits } ;
74- Ok ( if input. merge_commits . is_empty ( ) {
75- None
76- } else {
77- Some ( input)
78- } )
75+ if merge_commits. is_empty ( ) {
76+ return Ok ( None ) ;
77+ }
78+
79+ Ok ( Some ( NoMergesInput { merge_commits } ) )
7980}
8081
8182const DEFAULT_MESSAGE : & str = "
@@ -102,14 +103,15 @@ pub(super) async fn handle_input(
102103 let mut client = ctx. db . get ( ) . await ;
103104 let mut state: IssueData < ' _ , NoMergesState > =
104105 IssueData :: load ( & mut client, & event. issue , NO_MERGES_KEY ) . await ?;
106+ let first_time = state. data . mentioned_merge_commits . is_empty ( ) ;
105107
106108 let mut message = config
107109 . message
108110 . as_deref ( )
109111 . unwrap_or ( DEFAULT_MESSAGE )
110112 . to_string ( ) ;
111113
112- let since_last_posted = if state . data . mentioned_merge_commits . is_empty ( ) {
114+ let since_last_posted = if first_time {
113115 ""
114116 } else {
115117 " (since this message was last posted)"
@@ -132,6 +134,22 @@ pub(super) async fn handle_input(
132134 }
133135
134136 if should_send {
137+ if !first_time {
138+ // Check if the labels are still set.
139+ // Otherwise, they were probably removed manually.
140+ let any_removed = config. labels . iter ( ) . any ( |label| {
141+ // No label on the issue matches.
142+ event. issue . labels ( ) . iter ( ) . all ( |l| & l. name != label)
143+ } ) ;
144+
145+ if any_removed {
146+ // Assume it was a false positive, so don't
147+ // re-add the labels or send a message this time.
148+ state. save ( ) . await ?;
149+ return Ok ( ( ) ) ;
150+ }
151+ }
152+
135153 // Set labels
136154 let labels = config
137155 . labels
0 commit comments