Generate the commit message with the actual commit of main
This commit is contained in:
parent
f10a30f29c
commit
dcbb5e0e05
3 changed files with 25 additions and 1 deletions
1
bin/dune
1
bin/dune
|
@ -14,6 +14,7 @@
|
|||
fmt.tty
|
||||
logs.fmt
|
||||
git-unix
|
||||
bos
|
||||
yocaml
|
||||
yocaml_git
|
||||
yocaml_syndication
|
||||
|
|
24
bin/push.ml
24
bin/push.ml
|
@ -15,12 +15,34 @@ let reporter ppf =
|
|||
in
|
||||
{ Logs.report }
|
||||
|
||||
let run_git_rev_parse () =
|
||||
let open Bos in
|
||||
let value = OS.Cmd.run_out
|
||||
Cmd.(v "git" % "describe" % "--always" % "--dirty"
|
||||
% "--exclude=*" % "--abbrev=0")
|
||||
in
|
||||
match OS.Cmd.out_string value with
|
||||
| Ok (value, (_, `Exited 0)) -> Some value
|
||||
| Ok (value, (run_info, _)) ->
|
||||
Logs.warn (fun m -> m "Failed to get commit id: %a: %s"
|
||||
Cmd.pp (OS.Cmd.run_info_cmd run_info)
|
||||
value);
|
||||
None
|
||||
| Error `Msg e ->
|
||||
Logs.warn (fun m -> m "Failed to get commit id: %s" e);
|
||||
None
|
||||
|
||||
let message () =
|
||||
match run_git_rev_parse () with
|
||||
| Some hash -> Fmt.str "Pushed by YOCaml 2 from %s" hash
|
||||
| None -> Fmt.str "Pushed by YOCaml 2"
|
||||
|
||||
let () = Fmt_tty.setup_std_outputs ~style_renderer:`Ansi_tty ~utf_8:true ()
|
||||
let () = Logs.set_reporter (reporter Fmt.stdout)
|
||||
(* let () = Logs.set_level ~all:true (Some Logs.Debug) *)
|
||||
let author = ref "The Robur Team"
|
||||
let email = ref "team@robur.coop"
|
||||
let message = ref "Pushed by YOCaml 2"
|
||||
let message = ref (message ())
|
||||
let remote = ref "git@git.robur.coop:robur/blog.robur.coop.git#gh-pages"
|
||||
let host = ref "https://blog.robur.coop"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ depends: [
|
|||
"logs" {>= "0.7.0" }
|
||||
"cmdliner" { >= "1.0.0"}
|
||||
"http-lwt-client"
|
||||
"bos"
|
||||
"yocaml" {>= "2.0.1"}
|
||||
"yocaml_unix"
|
||||
"yocaml_yaml"
|
||||
|
|
Loading…
Reference in a new issue