@@ -17,9 +17,10 @@ module Github : Api.Github = struct
17
17
Option. value_map token ~default: headers ~f: (fun v -> sprintf " Authorization: token %s" v :: headers)
18
18
19
19
let get_config ~(ctx : Context.t ) ~repo =
20
+ let secrets = Context. get_secrets_exn ctx in
20
21
let url = contents_url ~repo ~path: ctx.config_filename in
21
- let headers = build_headers ?token:ctx .gh_token () in
22
- match % lwt http_get ~headers url with
22
+ let headers = build_headers ?token:secrets .gh_token () in
23
+ match % lwt http_request ~headers `GET url with
23
24
| Error e ->
24
25
log#error " error while querying %s: %s" url e;
25
26
Lwt. return @@ fmt_error " failed to get config from file %s" url
@@ -41,9 +42,10 @@ module Github : Api.Github = struct
41
42
)
42
43
43
44
let get_api_commit ~(ctx : Context.t ) ~repo ~sha =
45
+ let secrets = Context. get_secrets_exn ctx in
44
46
let url = commits_url ~repo ~sha in
45
- let headers = build_headers ?token:ctx .gh_token () in
46
- match % lwt http_get ~headers url with
47
+ let headers = build_headers ?token:secrets .gh_token () in
48
+ match % lwt http_request ~headers `GET url with
47
49
| Ok res -> Lwt. return @@ Ok (Github_j. api_commit_of_string res)
48
50
| Error e ->
49
51
log#error " error while querying %s: %s" url e;
@@ -55,8 +57,9 @@ module Slack : Api.Slack = struct
55
57
56
58
let send_notification ~chan ~msg ~url =
57
59
let data = Slack_j. string_of_webhook_notification msg in
60
+ let body = `Raw (" application/json" , data) in
58
61
log#info " sending to %s : %s" chan data;
59
- match % lwt http_post ~path: url ~data with
62
+ match % lwt http_request ~body `POST url with
60
63
| Ok _ -> Lwt. return @@ Ok ()
61
64
| Error e ->
62
65
log#error " error while querying %s: %s" url e;
0 commit comments