From 4e3bac142e3c764018112cd56e0c73bdfe3d53a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Nogueira?= Date: Tue, 31 Dec 2024 15:41:01 +0000 Subject: [PATCH] Add steps types configs --- lib/action.ml | 4 ++-- lib/config.atd | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/action.ml b/lib/action.ml index 9df06e7..6363e1a 100644 --- a/lib/action.ml +++ b/lib/action.ml @@ -168,12 +168,12 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct is not an email, so we need to see if we can map the commit author email to a slack user's email. *) let author = List.assoc_opt email cfg.user_mappings |> Option.default email in let dm_after_failed_build = - List.assoc_opt author cfg.notifications_configs.dm_after_failed_build + List.assoc_opt author cfg.notifications.dm_after_failed_build |> (* dm_after_failed_build is opt in *) Option.default false in let dm_for_failing_build = - List.assoc_opt author cfg.notifications_configs.dm_for_failing_build + List.assoc_opt author cfg.notifications.dm_for_failing_build |> (* dm_for_failing_build is opt out *) Option.default true in diff --git a/lib/config.atd b/lib/config.atd index 68903f6..952cb21 100644 --- a/lib/config.atd +++ b/lib/config.atd @@ -35,9 +35,18 @@ type project_owners = { rules: project_owners_rule list; } +type steps_types_configs = { + build: string list; + deploy: string list; + test: string list; + lint: string list; + ignore: string list +} + type notifications_configs = { ~dm_for_failing_build : (string * bool) list ; - ~dm_after_failed_build : (string * bool) list + ~dm_after_failed_build : (string * bool) list ; + ?steps_config : steps_types_configs nullable } (* This is the structure of the repository configuration file. It should be at the @@ -50,7 +59,7 @@ type config = { ~ignored_users : string list; (* list of ignored users *) ?main_branch_name : string nullable; (* the name of the main branch; used to filter out notifications about merges of main branch into other branches *) ~user_mappings : (string * string) list ; (* list of github to slack profile mappings *) - ~notifications_configs : notifications_configs; + ~notifications : notifications_configs; } (* This specifies the Slack webhook to query to post to the channel with the given name *)