coq/bot

Minimizer is treating all code blocks as Coq

JasonGross opened this issue · 4 comments

See coq/coq#17252 (comment)

Relevant code:

bot/src/actions.ml

Lines 1931 to 1940 in 3deea7d

if
List.mem ~equal:String.equal ["sh"; "bash"]
(String.lowercase quote_kind)
|| String.is_prefix ~prefix:"#!" body
then body
else
(* assume body is a .v file *)
let fname = "thebug.v" in
f "#!/usr/bin/env bash\ncat > %s <<'EOF'\n%s\nEOF\ncoqc -q %s" fname
body fname

and

bot/src/bot.ml

Lines 67 to 103 in 3deea7d

let coqbot_minimize_text_of_body body =
if
string_match
~regexp:
( f
"@%s:? [Mm]inimize\\([^`]*\\)```\\([^\n\
]*\\)\n\
\\(\\(.\\|\n\
\\)+\\)"
@@ Str.quote bot_name )
body
then
(* avoid internal server errors from unclear execution order *)
let options, quote_kind, body =
( Str.matched_group 1 body
, Str.matched_group 2 body
, Str.matched_group 3 body )
in
Some
( options
, MinimizeScript {quote_kind; body= body |> extract_minimize_file} )
else if
string_match
~regexp:
( f "@%s? [Mm]inimize\\([^`]*\\)\\[\\([^]]*\\)\\] *(\\([^)]*\\))"
@@ Str.quote bot_name )
body
then
(* avoid internal server errors from unclear execution order *)
let options, description, url =
( Str.matched_group 1 body
, Str.matched_group 2 body
, Str.matched_group 3 body )
in
Some (options, MinimizeAttachment {description; url})
else None
in

Maybe related: #268

Current leading hypothesis is that GitHub is reporting the comment as containing ```shell rather than what the user actually wrote.

Was this fixed by #270?

#270 failed to fix this, but #274 should have actually fixed this. I'll reopen if it's still an issue