@@ -48,11 +48,9 @@ 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. exclude_titles . iter ( ) . any ( |s| event. issue . title . contains ( s) ) {
53
+ return Ok ( None ) ;
56
54
}
57
55
58
56
let mut merge_commits = HashSet :: new ( ) ;
@@ -70,12 +68,11 @@ pub(super) async fn parse_input(
70
68
}
71
69
}
72
70
73
- let input = NoMergesInput { merge_commits } ;
74
- Ok ( if input. merge_commits . is_empty ( ) {
75
- None
76
- } else {
77
- Some ( input)
78
- } )
71
+ if merge_commits. is_empty ( ) {
72
+ return Ok ( None ) ;
73
+ }
74
+
75
+ Ok ( Some ( NoMergesInput { merge_commits } ) )
79
76
}
80
77
81
78
const DEFAULT_MESSAGE : & str = "
@@ -102,14 +99,15 @@ pub(super) async fn handle_input(
102
99
let mut client = ctx. db . get ( ) . await ;
103
100
let mut state: IssueData < ' _ , NoMergesState > =
104
101
IssueData :: load ( & mut client, & event. issue , NO_MERGES_KEY ) . await ?;
102
+ let first_time = state. data . mentioned_merge_commits . is_empty ( ) ;
105
103
106
104
let mut message = config
107
105
. message
108
106
. as_deref ( )
109
107
. unwrap_or ( DEFAULT_MESSAGE )
110
108
. to_string ( ) ;
111
109
112
- let since_last_posted = if state . data . mentioned_merge_commits . is_empty ( ) {
110
+ let since_last_posted = if first_time {
113
111
""
114
112
} else {
115
113
" (since this message was last posted)"
@@ -132,6 +130,17 @@ pub(super) async fn handle_input(
132
130
}
133
131
134
132
if should_send {
133
+ if !first_time {
134
+ // Check if the labels are already set.
135
+ // Otherwise, they were probably removed manually.
136
+ if !event. issue . labels ( ) . iter ( ) . all ( |label| config. labels . contains ( & label. name ) ) {
137
+ // Assume it was a false positive, so don't
138
+ // re-add the labels or send a message this time.
139
+ state. save ( ) . await ?;
140
+ return Ok ( ( ) ) ;
141
+ }
142
+ }
143
+
135
144
// Set labels
136
145
let labels = config
137
146
. labels
0 commit comments