@@ -48,11 +48,13 @@ pub(super) async fn parse_input(
48
48
return Ok ( None ) ;
49
49
}
50
50
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 ) ;
56
58
}
57
59
58
60
let mut merge_commits = HashSet :: new ( ) ;
@@ -70,12 +72,11 @@ pub(super) async fn parse_input(
70
72
}
71
73
}
72
74
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 } ) )
79
80
}
80
81
81
82
const DEFAULT_MESSAGE : & str = "
@@ -102,14 +103,15 @@ pub(super) async fn handle_input(
102
103
let mut client = ctx. db . get ( ) . await ;
103
104
let mut state: IssueData < ' _ , NoMergesState > =
104
105
IssueData :: load ( & mut client, & event. issue , NO_MERGES_KEY ) . await ?;
106
+ let first_time = state. data . mentioned_merge_commits . is_empty ( ) ;
105
107
106
108
let mut message = config
107
109
. message
108
110
. as_deref ( )
109
111
. unwrap_or ( DEFAULT_MESSAGE )
110
112
. to_string ( ) ;
111
113
112
- let since_last_posted = if state . data . mentioned_merge_commits . is_empty ( ) {
114
+ let since_last_posted = if first_time {
113
115
""
114
116
} else {
115
117
" (since this message was last posted)"
@@ -132,6 +134,22 @@ pub(super) async fn handle_input(
132
134
}
133
135
134
136
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
+
135
153
// Set labels
136
154
let labels = config
137
155
. labels
0 commit comments