@@ -87,13 +87,13 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
87
87
if List. is_empty matched_channel_names then default else matched_channel_names
88
88
89
89
let partition_status (ctx : Context.t ) (n : status_notification ) =
90
- let cfg = Context. get_config_exn ctx in
90
+ let cfg = State. get_repo_config_exn ctx.state in
91
91
let pipeline = n.context in
92
92
let current_status = n.state in
93
93
let rules = cfg.status_rules.rules in
94
94
let action_on_match (branches : branch list ) =
95
95
let default = Option. to_list cfg.prefix_rules.default_channel in
96
- let () = Context. refresh_pipeline_status ~pipeline ~branches ~status: current_status ctx in
96
+ let () = State. set_repo_pipeline_status ~pipeline ~branches ~status: current_status ctx.state in
97
97
match List. is_empty branches with
98
98
| true -> Lwt. return []
99
99
| false ->
@@ -111,7 +111,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
111
111
| Ok commit -> Lwt. return @@ partition_commit cfg commit.files
112
112
)
113
113
in
114
- if Context . is_pipeline_allowed ctx ~pipeline then begin
114
+ if State . is_pipeline_allowed ctx.state ~pipeline then begin
115
115
match Rule.Status. match_rules ~rules n with
116
116
| Some Ignore | None -> Lwt. return []
117
117
| Some Allow -> action_on_match n.branches
@@ -130,7 +130,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
130
130
else Lwt. return []
131
131
132
132
let partition_commit_comment (ctx : Context.t ) n =
133
- let cfg = Context. get_config_exn ctx in
133
+ let cfg = State. get_repo_config_exn ctx.state in
134
134
match n.comment.commit_id with
135
135
| None -> action_error " unable to find commit id for this commit comment event"
136
136
| Some sha ->
@@ -149,7 +149,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
149
149
)
150
150
151
151
let generate_notifications (ctx : Context.t ) req =
152
- let cfg = Context. get_config_exn ctx in
152
+ let cfg = State. get_repo_config_exn ctx.state in
153
153
match req with
154
154
| Github. Push n ->
155
155
partition_push cfg n |> List. map ~f: (fun (webhook , n ) -> webhook, generate_push_notification n) |> Lwt. return
@@ -198,12 +198,12 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
198
198
let repo = Github. repo_of_notification notification in
199
199
match % lwt Github_api. get_config ~ctx ~repo with
200
200
| Ok config ->
201
- ctx.config < - Some config;
201
+ ctx.state. config < - Some config;
202
202
Context. print_config ctx;
203
203
Lwt. return @@ Ok ()
204
204
| Error e -> action_error e
205
205
in
206
- match ctx.config with
206
+ match ctx.state. config with
207
207
| None -> fetch_config ()
208
208
| Some _ ->
209
209
match notification with
0 commit comments