Skip to content

Commit

Permalink
Merge pull request #1809 from reviewdog/outside-context
Browse files Browse the repository at this point in the history
Support posting comments outside diff context in github-pr-review reporter
  • Loading branch information
haya14busa authored Jul 6, 2024
2 parents d9e2eff + b20b457 commit e647d87
Show file tree
Hide file tree
Showing 19 changed files with 180 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/custom_rdjson.json | \
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-pr-review
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-pr-review -filter-mode=nofilter
- name: gofmt -s with reviewdog
env:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1807](https://github.com/reviewdog/reviewdog/pull/1807) Add -reporter=sarif
which outputs SARIF format to stdout. You can upload the output SARIF to
GitHub and see code scanning alerts.

- [#1809](https://github.com/reviewdog/reviewdog/pull/1809) Support posting
comments outside diff context as a file comment in github-pr-review reporter

### :bug: Fixes
- ...
Expand Down
2 changes: 2 additions & 0 deletions _testdata/custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ function f()
}

RelatedLoc

new line
6 changes: 6 additions & 0 deletions _testdata/custom_rdjson.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@
}
}
]
},
{
"message": "test file comment",
"location": {
"path": "_testdata/custom.txt"
}
}
]
}
2 changes: 1 addition & 1 deletion cmd/reviewdog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"golang.org/x/build/gerrit"
"golang.org/x/oauth2"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/mattn/go-shellwords"
"github.com/reviewdog/errorformat/fmts"
"github.com/xanzy/go-gitlab"
Expand Down
2 changes: 1 addition & 1 deletion doghouse/appengine/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"net/url"
"strings"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/justinas/nosurf"
"github.com/vvakame/sdlog/aelog"
"golang.org/x/oauth2"
Expand Down
2 changes: 1 addition & 1 deletion doghouse/appengine/github_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"net/http"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"

"github.com/reviewdog/reviewdog/doghouse/server/storage"
)
Expand Down
2 changes: 1 addition & 1 deletion doghouse/server/doghouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"fmt"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"

"github.com/reviewdog/reviewdog"
"github.com/reviewdog/reviewdog/diff"
Expand Down
2 changes: 1 addition & 1 deletion doghouse/server/doghouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/reviewdog/reviewdog/doghouse"
"github.com/reviewdog/reviewdog/proto/rdf"
)
Expand Down
2 changes: 1 addition & 1 deletion doghouse/server/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"

"github.com/bradleyfalzon/ghinstallation/v2"
"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
)

type NewGitHubClientOption struct {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.12
github.com/bradleyfalzon/ghinstallation/v2 v2.11.0
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v60 v60.0.0
github.com/google/go-github/v62 v62.0.0
github.com/haya14busa/go-actions-toolkit v0.0.0-20200105081403-ca0307860f01
github.com/haya14busa/go-sarif v0.0.0-20240630170108-a3ba8d79599f
github.com/haya14busa/secretbox v0.0.0-20180525171038-07c7ecf409f5
Expand Down Expand Up @@ -48,7 +48,6 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-github/v62 v62.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCy
github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk=
github.com/google/go-github/v62 v62.0.0 h1:/6mGCaRywZz9MuHyw9gD1CwsbmBX8GWsbFkwMmHdhl4=
github.com/google/go-github/v62 v62.0.0/go.mod h1:EMxeUqGJq2xRu9DYBMwel/mr7kZrzUOfQmmpYrZn2a4=
github.com/google/go-github/v62 v62.0.1-0.20240626135736-42ae4fe29180 h1:7hwybxRYjKO3kRzxJSW0S+H3b8yBtHF/oUL1ROmCx8Q=
github.com/google/go-github/v62 v62.0.1-0.20240626135736-42ae4fe29180/go.mod h1:EMxeUqGJq2xRu9DYBMwel/mr7kZrzUOfQmmpYrZn2a4=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
Expand Down
2 changes: 1 addition & 1 deletion scripts/trigger-depup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"strings"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion service/github/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
"time"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/reviewdog/reviewdog"
"github.com/reviewdog/reviewdog/cienv"
"github.com/reviewdog/reviewdog/filter"
Expand Down
2 changes: 1 addition & 1 deletion service/github/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/reviewdog/reviewdog"
"github.com/reviewdog/reviewdog/filter"
"github.com/reviewdog/reviewdog/proto/rdf"
Expand Down
2 changes: 1 addition & 1 deletion service/github/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"os/exec"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
"github.com/reviewdog/reviewdog"
)

Expand Down
2 changes: 1 addition & 1 deletion service/github/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v62/github"
)

const sampleDiff = `--- a/sample.old.txt 2016-10-13 05:09:35.820791185 +0900
Expand Down
Loading

0 comments on commit e647d87

Please sign in to comment.