Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting GITHUB_ENV and autoprinting github messages #3671

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/basic/FStarC.Options.fst
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ let defaults =
("eager_subtyping" , Bool false);
("error_contexts" , Bool false);
("expose_interfaces" , Bool false);
("message_format" , String "human");
("message_format" , String "auto");
("ext" , Unset);
("extract" , Unset);
("extract_all" , Bool false);
Expand Down Expand Up @@ -991,8 +991,10 @@ let rec specs_with_types warn_unsafe : list (char & string & opt_type & Pprint.d

( noshort,
"message_format",
EnumStr ["human"; "json"; "github"],
text "Format of the messages emitted by F* (default `human`)");
EnumStr ["human"; "json"; "github"; "auto"],
text "Format of the messages emitted by F*. Using 'auto' will use human messages \
unless the variable GITHUB_ACTIONS is non-empty, in which case 'github' is \
used (default `auto`).");

( noshort,
"hide_uvar_nums",
Expand Down Expand Up @@ -1993,8 +1995,17 @@ let dump_module s = get_dump_module() |> List.existsb (module_
let eager_subtyping () = get_eager_subtyping()
let error_contexts () = get_error_contexts ()
let expose_interfaces () = get_expose_interfaces ()
let interactive () = get_in () || get_ide () || get_lsp ()
let message_format () =
match get_message_format () with
| "auto" -> (
if interactive () then Human
else
match Util.expand_environment_variable "GITHUB_ACTIONS" with
| None
| Some "" -> Human
| Some _ -> Github
)
| "human" -> Human
| "json" -> Json
| "github" -> Github
Expand Down Expand Up @@ -2033,7 +2044,6 @@ let print () = get_print ()
let print_in_place () = get_print_in_place ()
let initial_fuel () = min (get_initial_fuel ()) (get_max_fuel ())
let initial_ifuel () = min (get_initial_ifuel ()) (get_max_ifuel ())
let interactive () = get_in () || get_ide () || get_lsp ()
let lax () = get_lax ()
let load () = get_load ()
let load_cmxs () = get_load_cmxs ()
Expand Down
Loading