Skip to content

Commit

Permalink
Add steps types configs
Browse files Browse the repository at this point in the history
  • Loading branch information
thatportugueseguy committed Dec 31, 2024
1 parent 8eb67f5 commit 4e3bac1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/action.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions lib/config.atd
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ocaml default="[]">: (string * bool) list <json repr="object">;
~dm_after_failed_build <ocaml default="[]">: (string * bool) list <json repr="object">
~dm_after_failed_build <ocaml default="[]">: (string * bool) list <json repr="object">;
?steps_config : steps_types_configs nullable
}

(* This is the structure of the repository configuration file. It should be at the
Expand All @@ -50,7 +59,7 @@ type config = {
~ignored_users <ocaml default="[]">: 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 <ocaml default="[]">: (string * string) list <json repr="object">; (* list of github to slack profile mappings *)
~notifications_configs <ocaml default="{dm_after_failed_build = []; dm_for_failing_build = []}"> : notifications_configs;
~notifications <ocaml default="{dm_after_failed_build = []; dm_for_failing_build = []; steps_config = None}"> : notifications_configs;
}

(* This specifies the Slack webhook to query to post to the channel with the given name *)
Expand Down

0 comments on commit 4e3bac1

Please sign in to comment.