@@ -21,7 +21,7 @@ let http_server_action addr port config secrets state =
21
21
(* * In check mode, instead of actually sending the message to slack, we
22
22
simply print it in the console *)
23
23
let check_gh_action file json config secrets state =
24
- match Github. event_of_filename file with
24
+ match Github. event_of_filename ( Caml.Filename. basename file) with
25
25
| None ->
26
26
log#error " aborting because payload %s is not named properly, named should be KIND.NAME_OF_PAYLOAD.json" file
27
27
| Some kind ->
@@ -30,14 +30,18 @@ let check_gh_action file json config secrets state =
30
30
| Ok body ->
31
31
let headers = [ " x-github-event" , kind ] in
32
32
let ctx = Context. make ~config_filename: config ~secrets_filepath: secrets ?state_filepath:state () in
33
- Lwt_main. run
34
- ( if json then
35
- let module Action = Action. Action (Api_remote. Github ) (Api_local. Slack_json ) in
36
- Action. process_github_notification ctx headers body
37
- else
38
- let module Action = Action. Action (Api_remote. Github ) (Api_local. Slack_simple ) in
39
- Action. process_github_notification ctx headers body
40
- )
33
+ ( match Context. refresh_secrets ctx with
34
+ | Error e -> log#error " %s" e
35
+ | Ok ctx ->
36
+ Lwt_main. run
37
+ ( if json then
38
+ let module Action = Action. Action (Api_remote. Github ) (Api_local. Slack_json ) in
39
+ Action. process_github_notification ctx headers body
40
+ else
41
+ let module Action = Action. Action (Api_remote. Github ) (Api_local. Slack_simple ) in
42
+ Action. process_github_notification ctx headers body
43
+ )
44
+ )
41
45
42
46
let check_slack_action url file =
43
47
let data = Stdio.In_channel. read_all file in
@@ -73,7 +77,7 @@ let secrets =
73
77
74
78
let state =
75
79
let doc = " state file" in
76
- Arg. (value & opt (some file ) None & info [ " state" ] ~docv: " STATE" ~doc )
80
+ Arg. (value & opt (some string ) None & info [ " state" ] ~docv: " STATE" ~doc )
77
81
78
82
let gh_payload =
79
83
let doc = " JSON file containing a github webhook payload" in
0 commit comments