Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add steps types configs #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading