From 90f21e6e86841352c3b0074865f37153577bfd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Nogueira?= Date: Mon, 16 Dec 2024 16:04:26 +0000 Subject: [PATCH] small cleaning of typos --- lib/action.ml | 2 +- lib/state.ml | 8 +++++--- lib/util.ml | 2 +- mock_states/status.commit1-02-failed_diff_pipeline.json | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/action.ml b/lib/action.ml index c7f2403..661e648 100644 --- a/lib/action.ml +++ b/lib/action.ml @@ -247,7 +247,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct | false -> let _, previous_build = StringMap.max_binding previous_builds in previous_build.status = n.state) - | _ -> + | None -> (* if we don't have any builds for this branch yet, it's the first notification for this pipeline *) false in diff --git a/lib/state.ml b/lib/state.ml index 0a3885b..3d17cad 100644 --- a/lib/state.ml +++ b/lib/state.ml @@ -24,9 +24,11 @@ let set_repo_state { state } repo_url repo_state = Stringtbl.replace state.repos let find_or_add_repo { state } repo_url = find_or_add_repo' state repo_url (** Updates the builds map in the branches statuses. - [default_builds_map] is the builds map to use if we don't have the current branch in the branches statuses. - [f] is the function to use to update the builds map. Takes the [State_t.build_status] Map for the current branch as argument. - [branches_statuses] is the branches statuses Map to update. Returns the updated branches statuses Map. *) + [default_builds_map] (optional, defaults to an empty map) is the builds map to use if we don't have the current + branch in the branches statuses. + [f] is the function to use to update the builds map. Takes the [State_t.build_status] Map for the current branch + as argument. + [branches_statuses] is the branches statuses Map to update. Returns the updated branches statuses Map. *) let update_builds_in_branches ~branches ?(default_builds_map = StringMap.empty) ~f branches_statuses = let current_statuses = Option.default StringMap.empty branches_statuses in let updated_statuses = diff --git a/lib/util.ml b/lib/util.ml index bd45cff..b52364b 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -52,7 +52,7 @@ module Build = struct Error (Printf.sprintf "failed to get pipeline name from notification. Context: %s, Build URL: %s" context build_url) in - (* if we have a buildkit pipeline, we need to strip the `buildkite/` prefix to get the real name *) + (* if we have a buildkite pipeline, we need to strip the `buildkite/` prefix to get the real name *) let context' = Stre.drop_prefix context "buildkite/" in let pipeline_name = get_name context' build_url in Result.map (fun pipeline_name -> { is_pipeline_step = pipeline_name <> context'; pipeline_name }) pipeline_name diff --git a/mock_states/status.commit1-02-failed_diff_pipeline.json b/mock_states/status.commit1-02-failed_diff_pipeline.json index 60cc470..3b551c8 100644 --- a/mock_states/status.commit1-02-failed_diff_pipeline.json +++ b/mock_states/status.commit1-02-failed_diff_pipeline.json @@ -3,7 +3,7 @@ "qa": { "author/patches/js-storage": { "181732": { - "status": "pending", + "status": "failure", "build_number": "181732", "build_url": "https://buildkite.com/ahrefs/qa/builds/181732", "commit": { @@ -11,7 +11,7 @@ "author": "author@ahrefs.com", "commit_message": "c1 message" }, - "is_finished": false, + "is_finished": true, "failed_steps": [ { "name": "qa/failed-step",