File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,31 @@ pub(super) async fn handle_input<'a>(
160
160
msg = msg. replace ( "{number}" , & event. issue . number . to_string ( ) ) ;
161
161
msg = msg. replace ( "{title}" , & event. issue . title ) ;
162
162
163
+ let teams = event
164
+ . issue
165
+ . labels
166
+ . iter ( )
167
+ . map ( |label| & label. name )
168
+ . filter_map ( |label| label. strip_prefix ( "T-" ) )
169
+ . collect :: < Vec < & str > > ( ) ;
170
+
171
+ if teams. is_empty ( ) {
172
+ log:: debug!( "No team label found, please investigate" ) ;
173
+ } else if teams. len ( ) == 1 {
174
+ // If there is a single team label, replace the placeholder straight away
175
+ // If there are multiple team labels and one of them is "compiler", pick that one
176
+ // (currently the only team handling these Zulip notification)
177
+ // if there are multiple team labels and none is "compiler", have someone else take a decision
178
+ msg = msg. replace ( "{team}" , teams[ 0 ] ) ;
179
+ } else if teams. contains ( & "compiler" ) {
180
+ msg = msg. replace ( "{team}" , "compiler" ) ;
181
+ } else {
182
+ msg = msg. replace (
183
+ "Needs `I-{team}-nominated`?" ,
184
+ "Issue needs to be nominated?" ,
185
+ ) ;
186
+ }
187
+
163
188
let zulip_req = crate :: zulip:: MessageApiRequest {
164
189
recipient : crate :: zulip:: Recipient :: Stream {
165
190
id : config. zulip_stream ,
You can’t perform that action at this time.
0 commit comments