feat(parser/resultdetail): files in code block conf
All checks were successful
submodules sync / sync (push) Successful in 35s
build / build (push) Successful in 1m6s
build / trigger-build-image (push) Successful in 7s

This commit is contained in:
张泊明518370910136 2024-11-28 14:30:31 -05:00
parent d76270d1ba
commit b3f76c24a7
GPG Key ID: D47306D7062CDA9D

View File

@ -15,7 +15,8 @@ type Conf struct {
ShowMemory bool `default:"true"`
ShowRunTime bool `default:"false"`
ShowFiles []string
MaxFileLength int `default:"65536"`
FilesInCodeBlock bool `default:"true"`
MaxFileLength int `default:"65536"`
}
type ResultDetail struct{}
@ -60,7 +61,11 @@ func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) (
if conf.MaxFileLength > 0 && len(content) > conf.MaxFileLength {
content = content[:conf.MaxFileLength] + "\n\n(truncated)"
}
comment += fmt.Sprintf("```\n%s\n```\n", content)
if conf.FilesInCodeBlock {
comment += fmt.Sprintf("```\n%s\n```\n", content)
} else {
comment += fmt.Sprintf("%s\n", content)
}
} else {
comment += "Not found\n"
}