Skip to content

Commit

Permalink
Move code_wrap to helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySkimmer committed May 3, 2023
1 parent e55f22a commit 5ee11fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ end
let fetch_bench_results ~job_info () =
let open BenchResults in
let open Lwt.Syntax in
let code_wrap str = f "```\n%s\n```" str in
let fetch_artifact url =
url |> Uri.of_string |> Client.get
>>= fun (resp, body) ->
Expand Down Expand Up @@ -375,7 +374,6 @@ let bench_text = function
| Ok results ->
(* Formatting helpers *)
let header2 str = f "## %s" str in
let code_wrap str = f "```\n%s\n```" str in
(* Document *)
let open BenchResults in
[ header2 ":checkered_flag: Bench Summary:"
Expand All @@ -401,7 +399,6 @@ let bench_comment ~bot_info ~owner ~repo ~number ~gitlab_url ?check_url
f "<details>\n<summary>%s</summary>\n\n%s\n\n</details>\n" summary
text
in
let code_wrap str = f "```\n%s\n```" str in
let link text url = f "[%s](%s)" text url in
[ ":checkered_flag: Bench results:"
; code_wrap results.summary_table
Expand Down
2 changes: 2 additions & 0 deletions src/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ open Base

let f = Printf.sprintf

let code_wrap str = f "```\n%s\n```" str

let string_match ~regexp ?(pos = 0) string =
try
let (_ : int) = Str.search_forward (Str.regexp regexp) string pos in
Expand Down
3 changes: 3 additions & 0 deletions src/helpers.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
val f : ('a, unit, string) format -> 'a

val code_wrap : string -> string
(** [code_wrap] = [f "```\n%s\n```"] *)

val string_match : regexp:string -> ?pos:int -> string -> bool

val fold_string_matches :
Expand Down

0 comments on commit 5ee11fc

Please sign in to comment.