From a2b335ad6a1d0b354d14b681b7f82021711d6aff Mon Sep 17 00:00:00 2001 From: Erik Nobel Date: Sun, 6 Dec 2020 02:01:47 +0100 Subject: [PATCH] Github pkg: Bump github package to version 33 (#222) --- .../runnerreplicaset_controller_test.go | 2 +- github/fake/runners.go | 2 +- github/github.go | 18 +++++++++--------- github/github_beta.go | 2 +- github/github_test.go | 2 +- go.mod | 2 ++ go.sum | 4 ++++ 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/controllers/runnerreplicaset_controller_test.go b/controllers/runnerreplicaset_controller_test.go index 1d7d68ebc1..a99acbf0e7 100644 --- a/controllers/runnerreplicaset_controller_test.go +++ b/controllers/runnerreplicaset_controller_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "time" - "github.com/google/go-github/v32/github" + "github.com/google/go-github/v33/github" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" diff --git a/github/fake/runners.go b/github/fake/runners.go index 1a60b67375..fbae51fe0f 100644 --- a/github/fake/runners.go +++ b/github/fake/runners.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "strconv" - "github.com/google/go-github/v32/github" + "github.com/google/go-github/v33/github" "github.com/gorilla/mux" ) diff --git a/github/github.go b/github/github.go index 7ffc5890a5..5ab41d177d 100644 --- a/github/github.go +++ b/github/github.go @@ -10,7 +10,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation" - "github.com/google/go-github/v32/github" + "github.com/google/go-github/v33/github" "golang.org/x/oauth2" ) @@ -32,6 +32,7 @@ type Client struct { GithubBaseURL string } +// NewClient creates a Github Client func (c *Config) NewClient() (*Client, error) { var ( httpClient *http.Client @@ -179,25 +180,25 @@ func (c *Client) cleanup() { func (c *Client) createRegistrationToken(ctx context.Context, owner, repo string) (*github.RegistrationToken, *github.Response, error) { if len(repo) > 0 { return c.Client.Actions.CreateRegistrationToken(ctx, owner, repo) - } else { - return CreateOrganizationRegistrationToken(ctx, c, owner) } + + return CreateOrganizationRegistrationToken(ctx, c, owner) } func (c *Client) removeRunner(ctx context.Context, owner, repo string, runnerID int64) (*github.Response, error) { if len(repo) > 0 { return c.Client.Actions.RemoveRunner(ctx, owner, repo, runnerID) - } else { - return RemoveOrganizationRunner(ctx, c, owner, runnerID) } + + return RemoveOrganizationRunner(ctx, c, owner, runnerID) } func (c *Client) listRunners(ctx context.Context, owner, repo string, opts *github.ListOptions) (*github.Runners, *github.Response, error) { if len(repo) > 0 { return c.Client.Actions.ListRunners(ctx, owner, repo, opts) - } else { - return ListOrganizationRunners(ctx, c, owner, opts) } + + return ListOrganizationRunners(ctx, c, owner, opts) } // Validates owner and repo arguments. Both are optional, but at least one should be specified @@ -214,9 +215,8 @@ func getOwnerAndRepo(org, repo string) (string, string, error) { func getRegistrationKey(org, repo string) string { if len(org) > 0 { return org - } else { - return repo } + return repo } func splitOwnerAndRepo(repo string) (string, string, error) { diff --git a/github/github_beta.go b/github/github_beta.go index e4611040b1..d1e3cc639e 100644 --- a/github/github_beta.go +++ b/github/github_beta.go @@ -10,7 +10,7 @@ import ( "net/url" "reflect" - "github.com/google/go-github/v32/github" + "github.com/google/go-github/v33/github" "github.com/google/go-querystring/query" ) diff --git a/github/github_test.go b/github/github_test.go index 6776c68fbb..90832d58c2 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/google/go-github/v32/github" + "github.com/google/go-github/v33/github" "github.com/summerwind/actions-runner-controller/github/fake" ) diff --git a/go.mod b/go.mod index 26d10e5add..29c388a4a6 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,9 @@ require ( github.com/bradleyfalzon/ghinstallation v1.1.1 github.com/davecgh/go-spew v1.1.1 github.com/go-logr/logr v0.1.0 + github.com/google/go-github v17.0.0+incompatible // indirect github.com/google/go-github/v32 v32.1.1-0.20200822031813-d57a3a84ba04 + github.com/google/go-github/v33 v33.0.0 github.com/google/go-querystring v1.0.0 github.com/gorilla/mux v1.8.0 github.com/kelseyhightower/envconfig v1.4.0 diff --git a/go.sum b/go.sum index f6b3a7647d..d4c55973bc 100644 --- a/go.sum +++ b/go.sum @@ -116,10 +116,14 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-github/v29 v29.0.2 h1:opYN6Wc7DOz7Ku3Oh4l7prmkOMwEcQxpFtxdU8N8Pts= github.com/google/go-github/v29 v29.0.2/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= github.com/google/go-github/v32 v32.1.1-0.20200822031813-d57a3a84ba04 h1:wEYk2h/GwOhImcVjiTIceP88WxVbXw2F+ARYUQMEsfg= github.com/google/go-github/v32 v32.1.1-0.20200822031813-d57a3a84ba04/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI= +github.com/google/go-github/v33 v33.0.0 h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM= +github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=