Skip to content

Commit e2ab985

Browse files
committed
more useful error message on unknown repo url
1 parent 011744b commit e2ab985

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/action.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
237237
let signing_key = Context.gh_hook_token_of_secrets secrets repo.url in
238238
Github.validate_signature ?signing_key ~headers body
239239
in
240-
let repo_is_supported secrets payload =
241-
let repo = Github.repo_of_notification payload in
240+
let repo_is_supported secrets (repo : Github_t.repository) =
242241
List.exists secrets.repos ~f:(fun r -> String.equal r.url repo.url)
243242
in
244243
try%lwt
@@ -249,14 +248,14 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
249248
match validate_signature secrets payload with
250249
| Error e -> action_error e
251250
| Ok () ->
252-
match repo_is_supported secrets payload with
253-
| false -> action_error "unsupported repository"
251+
let repo = Github.repo_of_notification payload in
252+
match repo_is_supported secrets repo with
253+
| false -> action_error @@ Printf.sprintf "unsupported repository %s" repo.url
254254
| true ->
255255
( match%lwt refresh_repo_config ctx payload with
256256
| Error e -> action_error e
257257
| Ok () ->
258258
let%lwt notifications = generate_notifications ctx payload in
259-
let repo = Github.repo_of_notification payload in
260259
let%lwt () = Lwt.join [ send_notifications ctx notifications; do_github_tasks ctx repo payload ] in
261260
( match ctx.state_filepath with
262261
| None -> Lwt.return_unit

0 commit comments

Comments
 (0)