Skip to content

Commit

Permalink
Merge pull request #644 from cloudflare/issue-608
Browse files Browse the repository at this point in the history
Add list of problems to gh report summary
  • Loading branch information
prymitive authored Jun 8, 2023
2 parents 7fd0105 + cfb10a7 commit 7ca1053
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true

- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true

- name: Compile pint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true

- name: Set up QEMU
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true

- name: Build binary
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-mod-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5

- name: Run go mod tidy
run: go mod tidy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true
cache-dependency-path: tools/golangci-lint/go.sum

Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true
cache-dependency-path: tools/gofumpt/go.sum

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
go-version: 1.20.5
cache: true

- name: Test
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
This allows to only show estimated alerts count only if there would be high
enough (`>= minCount`) number of alerts.
Setting `severity` as well allows to block rules that would create too many alerts.
- GitHub reporter will now included folded list of all problems in the summary
comment - #608.

### Fixed

Expand Down
18 changes: 18 additions & 0 deletions internal/reporter/github.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package reporter

import (
"bytes"
"context"
"fmt"
"strconv"
Expand Down Expand Up @@ -251,6 +252,23 @@ func formatGHReviewBody(version string, summary Summary) string {

b.WriteString("\n</p>\n</details>\n\n")

b.WriteString("<details><summary>Problems</summary>\n<p>\n\n")
if summary.Entries > 0 {
buf := bytes.NewBuffer(nil)
cr := NewConsoleReporter(buf, checks.Information)
err := cr.Submit(summary)
if err != nil {
b.WriteString(fmt.Sprintf("Failed to generate list of problems: %s", err))
} else {
b.WriteString("```\n")
b.WriteString(buf.String())
b.WriteString("```\n")
}
} else {
b.WriteString("No problems reported")
}
b.WriteString("\n</p>\n</details>\n\n")

return b.String()
}

Expand Down

0 comments on commit 7ca1053

Please sign in to comment.