Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 96b90fc

Browse files
author
Noah Lee
authored
Fix to map the avatar_url field (#366)
* Upgrade the github package * Fix to set the avatar_url
1 parent 8c5aefc commit 96b90fc

File tree

12 files changed

+32
-21
lines changed

12 files changed

+32
-21
lines changed

Diff for: go.mod

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ require (
4040
github.com/go-playground/universal-translator v0.17.0 // indirect
4141
github.com/go-playground/validator/v10 v10.6.1 // indirect
4242
github.com/golang/protobuf v1.5.2 // indirect
43-
github.com/google/go-querystring v1.0.0 // indirect
43+
github.com/google/go-github/v42 v42.0.0 // indirect
44+
github.com/google/go-querystring v1.1.0 // indirect
4445
github.com/google/uuid v1.3.0 // indirect
4546
github.com/gorilla/websocket v1.4.2 // indirect
4647
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
@@ -68,11 +69,11 @@ require (
6869
github.com/ugorji/go/codec v1.2.6 // indirect
6970
go.uber.org/atomic v1.7.0 // indirect
7071
go.uber.org/multierr v1.6.0 // indirect
71-
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
72+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
7273
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
7374
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
7475
golang.org/x/text v0.3.6 // indirect
75-
google.golang.org/appengine v1.6.6 // indirect
76+
google.golang.org/appengine v1.6.7 // indirect
7677
google.golang.org/protobuf v1.26.0 // indirect
7778
gopkg.in/yaml.v2 v2.4.0 // indirect
7879
)

Diff for: go.sum

+8
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,19 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
180180
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
181181
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
182182
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
183+
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
183184
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
184185
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
185186
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
186187
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
187188
github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II=
188189
github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
190+
github.com/google/go-github/v42 v42.0.0 h1:YNT0FwjPrEysRkLIiKuEfSvBPCGKphW5aS5PxwaoLec=
191+
github.com/google/go-github/v42 v42.0.0/go.mod h1:jgg/jvyI0YlDOM1/ps6XYh04HNQ3vKf0CVko62/EhRg=
189192
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
190193
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
194+
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
195+
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
191196
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
192197
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
193198
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@@ -506,6 +511,8 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP
506511
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
507512
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
508513
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
514+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
515+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
509516
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
510517
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
511518
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -735,6 +742,7 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww
735742
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
736743
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
737744
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
745+
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
738746
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
739747
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
740748
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=

Diff for: internal/pkg/github/deployment.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/gitploy-io/gitploy/model/ent"
1010
"github.com/gitploy-io/gitploy/model/extent"
1111
"github.com/gitploy-io/gitploy/pkg/e"
12-
"github.com/google/go-github/v32/github"
12+
"github.com/google/go-github/v42/github"
1313
)
1414

1515
func (g *Github) CreateRemoteDeployment(ctx context.Context, u *ent.User, r *ent.Repo, d *ent.Deployment, env *extent.Env) (*extent.RemoteDeployment, error) {
@@ -47,7 +47,7 @@ func (g *Github) CreateRemoteDeployment(ctx context.Context, u *ent.User, r *ent
4747
var url string
4848
commit, _, err := g.Client(ctx, u.Token).
4949
Repositories.
50-
GetCommit(ctx, r.Namespace, r.Name, *gd.SHA)
50+
GetCommit(ctx, r.Namespace, r.Name, *gd.SHA, &github.ListOptions{})
5151
if err == nil {
5252
url = *commit.HTMLURL
5353
}

Diff for: internal/pkg/github/deploymentstatus.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/gitploy-io/gitploy/model/ent"
77
"github.com/gitploy-io/gitploy/model/extent"
88
"github.com/gitploy-io/gitploy/pkg/e"
9-
"github.com/google/go-github/v32/github"
9+
"github.com/google/go-github/v42/github"
1010
)
1111

1212
func (g *Github) CreateRemoteDeploymentStatus(ctx context.Context, u *ent.User, r *ent.Repo, d *ent.Deployment, ds *extent.RemoteDeploymentStatus) (*extent.RemoteDeploymentStatus, error) {

Diff for: internal/pkg/github/github.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package github
33
import (
44
"context"
55

6-
"github.com/google/go-github/v32/github"
6+
"github.com/google/go-github/v42/github"
77
graphql "github.com/shurcooL/githubv4"
88
"golang.org/x/oauth2"
99
)

Diff for: internal/pkg/github/mapper.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strings"
55

66
"github.com/gitploy-io/gitploy/model/extent"
7-
"github.com/google/go-github/v32/github"
7+
"github.com/google/go-github/v42/github"
88
)
99

1010
func mapGithubUserToUser(u *github.User) *extent.RemoteUser {
@@ -32,7 +32,7 @@ func mapGithubRepoToRemotePerm(r *github.Repository) *extent.RemoteRepo {
3232
Namespace: namespace,
3333
Name: name,
3434
Description: *r.Description,
35-
Perm: mapGithubPermToRepoPerm(*r.Permissions),
35+
Perm: mapGithubPermToRepoPerm(r.Permissions),
3636
}
3737
}
3838

@@ -100,13 +100,15 @@ func mapGithubStatusToStatus(s *github.RepoStatus) *extent.Status {
100100
}
101101

102102
status := &extent.Status{
103-
Context: *s.Context,
104-
AvatarURL: "",
105-
State: state,
103+
Context: *s.Context,
104+
State: state,
106105
}
107106
if s.TargetURL != nil {
108107
status.TargetURL = *s.TargetURL
109108
}
109+
if s.AvatarURL != nil {
110+
status.AvatarURL = *s.AvatarURL
111+
}
110112

111113
return status
112114
}

Diff for: internal/pkg/github/repos.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"net/http"
66

7-
"github.com/google/go-github/v32/github"
7+
"github.com/google/go-github/v42/github"
88
graphql "github.com/shurcooL/githubv4"
99

1010
"github.com/gitploy-io/gitploy/internal/interactor"
@@ -51,7 +51,7 @@ func (g *Github) CompareCommits(ctx context.Context, u *ent.User, r *ent.Repo, b
5151
// TODO: Support pagination.
5252
res, _, err := g.Client(ctx, u.Token).
5353
Repositories.
54-
CompareCommits(ctx, r.Namespace, r.Name, base, head)
54+
CompareCommits(ctx, r.Namespace, r.Name, base, head, &github.ListOptions{})
5555
if err != nil {
5656
return nil, nil, err
5757
}
@@ -72,7 +72,7 @@ func (g *Github) CompareCommits(ctx context.Context, u *ent.User, r *ent.Repo, b
7272
func (g *Github) GetCommit(ctx context.Context, u *ent.User, r *ent.Repo, sha string) (*extent.Commit, error) {
7373
cm, res, err := g.Client(ctx, u.Token).
7474
Repositories.
75-
GetCommit(ctx, r.Namespace, r.Name, sha)
75+
GetCommit(ctx, r.Namespace, r.Name, sha, &github.ListOptions{})
7676
// Github returns Unprocessable entity if the commit is not found.
7777
if res.StatusCode == http.StatusNotFound || res.StatusCode == http.StatusUnprocessableEntity {
7878
return nil, e.NewErrorWithMessage(e.ErrorCodeEntityNotFound, "The commit is not found.", err)
@@ -147,7 +147,7 @@ func (g *Github) ListBranches(ctx context.Context, u *ent.User, r *ent.Repo, opt
147147
func (g *Github) GetBranch(ctx context.Context, u *ent.User, r *ent.Repo, branch string) (*extent.Branch, error) {
148148
b, res, err := g.Client(ctx, u.Token).
149149
Repositories.
150-
GetBranch(ctx, r.Namespace, r.Name, branch)
150+
GetBranch(ctx, r.Namespace, r.Name, branch, false)
151151
if res.StatusCode == http.StatusNotFound {
152152
return nil, e.NewErrorWithMessage(e.ErrorCodeEntityNotFound, "The branch is not found.", err)
153153
} else if err != nil {

Diff for: internal/pkg/github/sync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/gitploy-io/gitploy/model/ent"
77
"github.com/gitploy-io/gitploy/model/extent"
88
"github.com/gitploy-io/gitploy/pkg/e"
9-
"github.com/google/go-github/v32/github"
9+
"github.com/google/go-github/v42/github"
1010
)
1111

1212
func (g *Github) ListRemoteRepos(ctx context.Context, u *ent.User) ([]*extent.RemoteRepo, error) {

Diff for: internal/pkg/github/user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/gitploy-io/gitploy/model/ent"
77
"github.com/gitploy-io/gitploy/model/extent"
8-
"github.com/google/go-github/v32/github"
8+
"github.com/google/go-github/v42/github"
99
)
1010

1111
func (g *Github) GetRateLimit(ctx context.Context, u *ent.User) (*extent.RateLimit, error) {

Diff for: internal/pkg/github/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55

66
"github.com/gitploy-io/gitploy/model/extent"
7-
"github.com/google/go-github/v32/github"
7+
"github.com/google/go-github/v42/github"
88
)
99

1010
func (g *Github) GetRemoteUserByToken(ctx context.Context, token string) (*extent.RemoteUser, error) {

Diff for: internal/server/hooks/hook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/gin-gonic/gin"
88
"github.com/gin-gonic/gin/binding"
9-
"github.com/google/go-github/v32/github"
9+
"github.com/google/go-github/v42/github"
1010
"go.uber.org/zap"
1111

1212
gb "github.com/gitploy-io/gitploy/internal/server/global"

Diff for: internal/server/hooks/hook_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/AlekSi/pointer"
1212
"github.com/gin-gonic/gin"
1313
"github.com/golang/mock/gomock"
14-
"github.com/google/go-github/v32/github"
14+
"github.com/google/go-github/v42/github"
1515

1616
"github.com/gitploy-io/gitploy/internal/server/hooks/mock"
1717
"github.com/gitploy-io/gitploy/model/ent"

0 commit comments

Comments
 (0)