forked from robur/blog.robur.coop
Merge pull request 'Generate the commit message with the actual commit of main' (#20) from with-nice-commit into main
Reviewed-on: robur/blog.robur.coop#20
This commit is contained in:
commit
4a4c22e244
3 changed files with 25 additions and 1 deletions
1
bin/dune
1
bin/dune
|
@ -14,6 +14,7 @@
|
||||||
fmt.tty
|
fmt.tty
|
||||||
logs.fmt
|
logs.fmt
|
||||||
git-unix
|
git-unix
|
||||||
|
bos
|
||||||
yocaml
|
yocaml
|
||||||
yocaml_git
|
yocaml_git
|
||||||
yocaml_syndication
|
yocaml_syndication
|
||||||
|
|
24
bin/push.ml
24
bin/push.ml
|
@ -15,12 +15,34 @@ let reporter ppf =
|
||||||
in
|
in
|
||||||
{ Logs.report }
|
{ 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 () = Fmt_tty.setup_std_outputs ~style_renderer:`Ansi_tty ~utf_8:true ()
|
||||||
let () = Logs.set_reporter (reporter Fmt.stdout)
|
let () = Logs.set_reporter (reporter Fmt.stdout)
|
||||||
(* let () = Logs.set_level ~all:true (Some Logs.Debug) *)
|
(* let () = Logs.set_level ~all:true (Some Logs.Debug) *)
|
||||||
let author = ref "The Robur Team"
|
let author = ref "The Robur Team"
|
||||||
let email = ref "team@robur.coop"
|
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 remote = ref "git@git.robur.coop:robur/blog.robur.coop.git#gh-pages"
|
||||||
let host = ref "https://blog.robur.coop"
|
let host = ref "https://blog.robur.coop"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ depends: [
|
||||||
"logs" {>= "0.7.0" }
|
"logs" {>= "0.7.0" }
|
||||||
"cmdliner" { >= "1.0.0"}
|
"cmdliner" { >= "1.0.0"}
|
||||||
"http-lwt-client"
|
"http-lwt-client"
|
||||||
|
"bos"
|
||||||
"yocaml" {>= "2.0.1"}
|
"yocaml" {>= "2.0.1"}
|
||||||
"yocaml_unix"
|
"yocaml_unix"
|
||||||
"yocaml_yaml"
|
"yocaml_yaml"
|
||||||
|
|
Loading…
Reference in a new issue