@@ -204,7 +204,7 @@ let defaults =
204204 ( " eager_subtyping" , Bool false );
205205 ( " error_contexts" , Bool false );
206206 ( " expose_interfaces" , Bool false );
207- ( " message_format" , String " human " );
207+ ( " message_format" , String " auto " );
208208 ( " ext" , Unset );
209209 ( " extract" , Unset );
210210 ( " extract_all" , Bool false );
@@ -991,8 +991,10 @@ let rec specs_with_types warn_unsafe : list (char & string & opt_type & Pprint.d
991991
992992 ( noshort,
993993 "message_format",
994- EnumStr ["human"; "json"; "github"],
995- text "Format of the messages emitted by F* (default `human`)");
994+ EnumStr ["human"; "json"; "github"; "auto"],
995+ text "Format of the messages emitted by F*. Using 'auto' will use human messages \
996+ unless the variable GITHUB_ACTIONS is non-empty, in which case 'github' is \
997+ used (default `auto`).");
996998
997999 ( noshort,
9981000 "hide_uvar_nums",
@@ -1993,8 +1995,17 @@ let dump_module s = get_dump_module() |> List.existsb (module_
19931995let eager_subtyping () = get_eager_subtyping()
19941996let error_contexts () = get_error_contexts ()
19951997let expose_interfaces () = get_expose_interfaces ()
1998+ let interactive () = get_in () || get_ide () || get_lsp ()
19961999let message_format () =
19972000 match get_message_format () with
2001+ | "auto" -> (
2002+ if interactive () then Human
2003+ else
2004+ match Util.expand_environment_variable "GITHUB_ACTIONS" with
2005+ | None
2006+ | Some "" -> Human
2007+ | Some _ -> Github
2008+ )
19982009 | "human" -> Human
19992010 | "json" -> Json
20002011 | "github" -> Github
@@ -2033,7 +2044,6 @@ let print () = get_print ()
20332044let print_in_place () = get_print_in_place ()
20342045let initial_fuel () = min (get_initial_fuel ()) (get_max_fuel ())
20352046let initial_ifuel () = min (get_initial_ifuel ()) (get_max_ifuel ())
2036- let interactive () = get_in () || get_ide () || get_lsp ()
20372047let lax () = get_lax ()
20382048let load () = get_load ()
20392049let load_cmxs () = get_load_cmxs ()
0 commit comments