@@ -21,7 +21,7 @@ let http_server_action addr port config secrets state =
2121(* * In check mode, instead of actually sending the message to slack, we
2222 simply print it in the console *)
2323let 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
2525 | None ->
2626 log#error " aborting because payload %s is not named properly, named should be KIND.NAME_OF_PAYLOAD.json" file
2727 | Some kind ->
@@ -30,14 +30,18 @@ let check_gh_action file json config secrets state =
3030 | Ok body ->
3131 let headers = [ " x-github-event" , kind ] in
3232 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+ )
4145
4246let check_slack_action url file =
4347 let data = Stdio.In_channel. read_all file in
@@ -73,7 +77,7 @@ let secrets =
7377
7478let state =
7579 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 )
7781
7882let gh_payload =
7983 let doc = " JSON file containing a github webhook payload" in
0 commit comments