@@ -32,10 +32,12 @@ let get_mock_slack_events () =
32
32
let process_gh_payload ~(secrets : Config_t.secrets ) ~config (kind , path , state_path ) =
33
33
let headers = [ " x-github-event" , kind ] in
34
34
let make_test_context event =
35
- let repo = Github. repo_of_notification @@ Github. parse_exn headers event in
35
+ let ctx = Context. make () in
36
+ let get_build_branch = Api_local.Buildkite. get_build_branch ~ctx in
37
+ let % lwt n = Github. parse_exn headers event ~get_build_branch in
38
+ let repo = Github. repo_of_notification n in
36
39
(* overwrite repo url in secrets with that of notification for this test case *)
37
40
let secrets = { secrets with repos = [ { url = repo.url; gh_token = None ; gh_hook_secret = None } ] } in
38
- let ctx = Context. make () in
39
41
ctx.secrets < - Some secrets;
40
42
let (_ : State_t.repo_state ) = State. find_or_add_repo ctx.state repo.url in
41
43
let () =
@@ -48,13 +50,13 @@ let process_gh_payload ~(secrets : Config_t.secrets) ~config (kind, path, state_
48
50
Context. set_repo_config ctx repo.url config
49
51
| exception exn -> log#error ~exn " failed to load state from file %s" state_path
50
52
in
51
- ctx
53
+ Lwt. return ctx
52
54
in
53
55
Printf. printf " ===== file %s =====\n " path;
54
56
let headers = [ " x-github-event" , kind ] in
55
57
match Std. input_file path with
56
58
| event ->
57
- let ctx = make_test_context event in
59
+ let % lwt ctx = make_test_context event in
58
60
Action_local. process_github_notification ctx headers event
59
61
| exception exn ->
60
62
log#error ~exn " failed to read file %s" path;
0 commit comments