Skip to content

Commit

Permalink
fix: add all output
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrabovcin committed Feb 19, 2024
1 parent 5d895ae commit a068eb3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/actions/copacetic-action/pkg/patch/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"strings"

md "github.com/go-spectest/markdown"

Expand Down Expand Up @@ -58,7 +59,7 @@ func WriteMarkdown(report Report, w io.Writer) error {
md.Code(row.Patched),
}
if row.Error != "" {
mdRow = append(mdRow, md.Link("View error", fmt.Sprintf("#error-%d", i)))
mdRow = append(mdRow, md.Link("View error", fmt.Sprintf("#user-content-error-%d", i)))
details = append(details, []string{
row.Image,
fmt.Sprintf("error-%d", i),
Expand All @@ -75,8 +76,12 @@ func WriteMarkdown(report Report, w io.Writer) error {
doc.H2("Errors")
}
for _, detail := range details {
doc.PlainText(fmt.Sprintf(`<a name="%s" />`, detail[1]))
doc.Details(detail[0], fmt.Sprintf("<pre>%s</pre>", detail[2]))
doc.PlainText(fmt.Sprintf(`<a name="%s"></a>`, detail[1]))
content := []string{}
for i := 2; i < len(detail); i++ {
content = append(content, fmt.Sprintf("<pre>%s</pre>", detail[i]))
}
doc.Details(detail[0], strings.Join(content, "\n"))
}

return doc.Build()
Expand Down

0 comments on commit a068eb3

Please sign in to comment.