@@ -13,7 +13,7 @@ type prefix_match =
13
13
| Match of int
14
14
| NoMatch
15
15
16
- let chan_of_prefix_rule (r : prefix_rule ) = r.chan
16
+ let chan_of_prefix_rule (r : prefix_rule ) = r.channel_name
17
17
18
18
let touching_prefix (rule : Notabot_t.prefix_rule ) name =
19
19
let match_lengths filename prefixes =
@@ -24,10 +24,10 @@ let touching_prefix (rule : Notabot_t.prefix_rule) name =
24
24
match match_lengths name rule.ignore with
25
25
| _ :: _ -> NoMatch
26
26
| [] ->
27
- match rule.prefix with
27
+ match rule.allow with
28
28
| [] -> Match 0
29
29
| _ ->
30
- match List. max_elt (match_lengths name rule.prefix ) ~compare: Int. compare with
30
+ match List. max_elt (match_lengths name rule.allow ) ~compare: Int. compare with
31
31
| Some x -> Match x
32
32
| None -> NoMatch
33
33
@@ -58,7 +58,7 @@ let unique_chans_of_files rules files =
58
58
59
59
let touching_label rule name =
60
60
let name_lc = String. lowercase name in
61
- let label_lc = List. map rule.label_name ~f: (fun l -> String. lowercase l) in
61
+ let label_lc = List. map rule.allow ~f: (fun l -> String. lowercase l) in
62
62
let ignore_lc = List. map rule.ignore ~f: (fun l -> String. lowercase l) in
63
63
(* convert both labels and config into lowe-case to make label matching case-insensitive *)
64
64
(List. is_empty label_lc || List. mem ~equal: String. equal label_lc name_lc)
@@ -93,7 +93,9 @@ let group_commit chan l =
93
93
| true -> Some commit)
94
94
95
95
let partition_push cfg n =
96
- let default commit = Option. value_map cfg.prefix_rules.default ~default: [] ~f: (fun webhook -> [ webhook, commit ]) in
96
+ let default commit =
97
+ Option. value_map cfg.prefix_rules.default_channel ~default: [] ~f: (fun webhook -> [ webhook, commit ])
98
+ in
97
99
let rules = cfg.prefix_rules.rules in
98
100
let channels =
99
101
n.commits
@@ -110,7 +112,10 @@ let partition_push cfg n =
110
112
|> List. concat
111
113
in
112
114
let prefix_chans =
113
- let chans = Option. to_list cfg.prefix_rules.default @ List. map rules ~f: (fun (rule : prefix_rule ) -> rule.chan) in
115
+ let chans =
116
+ Option. to_list cfg.prefix_rules.default_channel
117
+ @ List. map rules ~f: (fun (rule : prefix_rule ) -> rule.channel_name)
118
+ in
114
119
List. dedup_and_sort chans ~compare: String. compare
115
120
in
116
121
List. filter_map prefix_chans ~f: (fun chan ->
@@ -123,10 +128,10 @@ let filter_label rules (label : Github_j.label) =
123
128
|> List. filter_map ~f: (fun rule ->
124
129
match touching_label rule label.name with
125
130
| false -> None
126
- | true -> Some rule.chan )
131
+ | true -> Some rule.channel_name )
127
132
128
133
let partition_label cfg (labels : Github_j.label list ) =
129
- let default = Option. to_list cfg.label_rules.default in
134
+ let default = Option. to_list cfg.label_rules.default_channel in
130
135
match labels with
131
136
| [] -> default
132
137
| labels ->
@@ -180,7 +185,7 @@ let partition_commit cfg files =
180
185
let names = List. map ~f: (fun f -> f.filename) files in
181
186
match unique_chans_of_files cfg.prefix_rules.rules names with
182
187
| _ :: _ as xs -> xs
183
- | [] -> Option. to_list cfg.prefix_rules.default
188
+ | [] -> Option. to_list cfg.prefix_rules.default_channel
184
189
185
190
let hide_cancelled (notification : status_notification ) cfg =
186
191
let find_cancelled status_state =
@@ -216,7 +221,7 @@ let hide_success (n : status_notification) (ctx : Context.t) =
216
221
let partition_status (ctx : Context.t ) (n : status_notification ) =
217
222
let cfg = ctx.cfg in
218
223
let get_commit_info () =
219
- let default () = Lwt. return @@ Option. to_list cfg.prefix_rules.default in
224
+ let default () = Lwt. return @@ Option. to_list cfg.prefix_rules.default_channel in
220
225
match cfg.main_branch_name with
221
226
| None -> default ()
222
227
| Some main_branch_name ->
@@ -263,7 +268,7 @@ let partition_status (ctx : Context.t) (n : status_notification) =
263
268
res
264
269
265
270
let partition_commit_comment cfg n =
266
- let default = Option. to_list cfg.prefix_rules.default in
271
+ let default = Option. to_list cfg.prefix_rules.default_channel in
267
272
match n.comment.path with
268
273
| None ->
269
274
( match % lwt Github. generate_commit_from_commit_comment cfg n with
@@ -308,25 +313,25 @@ let generate_notifications (ctx : Context.t) req =
308
313
let print_prefix_routing rules =
309
314
let show_match l = String. concat ~sep: " or " @@ List. map ~f: (fun s -> s ^ " *" ) l in
310
315
rules
311
- |> List. iter ~f: (fun rule ->
316
+ |> List. iter ~f: (fun ( rule : prefix_rule ) ->
312
317
begin
313
- match rule.prefix , rule.ignore with
318
+ match rule.allow , rule.ignore with
314
319
| [] , [] -> Stdio. printf " any"
315
320
| l , [] -> Stdio. printf " %s" (show_match l)
316
321
| [] , l -> Stdio. printf " not %s" (show_match l)
317
322
| l , i -> Stdio. printf " %s and not %s" (show_match l) (show_match i)
318
323
end ;
319
- Stdio. printf " -> #%s\n %!" rule.chan )
324
+ Stdio. printf " -> #%s\n %!" rule.channel_name )
320
325
321
326
let print_label_routing rules =
322
327
let show_match l = String. concat ~sep: " or " l in
323
328
rules
324
- |> List. iter ~f: (fun rule ->
329
+ |> List. iter ~f: (fun ( rule : label_rule ) ->
325
330
begin
326
- match rule.label_name , rule.ignore with
331
+ match rule.allow , rule.ignore with
327
332
| [] , [] -> Stdio. printf " any"
328
333
| l , [] -> Stdio. printf " %s" (show_match l)
329
334
| [] , l -> Stdio. printf " not %s" (show_match l)
330
335
| l , i -> Stdio. printf " %s and not %s" (show_match l) (show_match i)
331
336
end ;
332
- Stdio. printf " -> #%s\n %!" rule.chan )
337
+ Stdio. printf " -> #%s\n %!" rule.channel_name )
0 commit comments