Skip to content

Commit

Permalink
Update github sdk and fix appscode-cloud rules
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed May 2, 2024
1 parent a3acd1b commit aca5e1f
Show file tree
Hide file tree
Showing 635 changed files with 11,576 additions and 83,307 deletions.
2 changes: 1 addition & 1 deletion cmds/add_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"os"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/copy_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"strings"
"time"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/del_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"os"
"time"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/del_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"strings"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/list_orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"log"
"os"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/list_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"sort"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/sets"
Expand Down
30 changes: 17 additions & 13 deletions cmds/protect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strings"
"time"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down Expand Up @@ -411,7 +411,7 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
p := &github.ProtectionRequest{
RequiredStatusChecks: &github.RequiredStatusChecks{
Strict: true,
Checks: []*github.RequiredStatusCheck{
Checks: &[]*github.RequiredStatusCheck{
{Context: "Build"},
{Context: "DCO"},
},
Expand All @@ -432,23 +432,24 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
// Apps: []string{"kodiakhq"},
},
}
if owner == "bytebuilders" || owner == "kubedb" || owner == "kubestash" {
if owner == "appscode-cloud" || owner == "kubedb" || owner == "kubestash" {
p.Restrictions.Apps = []string{"kodiak-appscode"}
} else {
p.Restrictions.Apps = []string{"kodiakhq"}
}

if !private {
p.RequiredStatusChecks.Checks = append(
p.RequiredStatusChecks.Checks,
checks := append(
*p.RequiredStatusChecks.Checks,
&github.RequiredStatusCheck{Context: "license/cla"},
)
p.RequiredStatusChecks.Checks = &checks
}

if repo == "installer" ||
(owner == "stashed" && repo == "catalog") {
p.RequiredStatusChecks.Checks = append(
p.RequiredStatusChecks.Checks,
checks := append(
*p.RequiredStatusChecks.Checks,
&github.RequiredStatusCheck{Context: "Kubernetes (v1.21.14)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.22.17)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.23.17)"},
Expand All @@ -457,10 +458,11 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
&github.RequiredStatusCheck{Context: "Kubernetes (v1.26.3)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.27.1)"},
)
p.RequiredStatusChecks.Checks = &checks
}
if repo == "ui-wizards" {
p.RequiredStatusChecks.Checks = append(
p.RequiredStatusChecks.Checks,
checks := append(
*p.RequiredStatusChecks.Checks,
&github.RequiredStatusCheck{Context: "Kubernetes (v1.21.14)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.22.17)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.23.17)"},
Expand All @@ -469,10 +471,11 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
&github.RequiredStatusCheck{Context: "Kubernetes (v1.26.3)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.27.1)"},
)
p.RequiredStatusChecks.Checks = &checks
}
if owner == "voyagermesh" {
p.RequiredStatusChecks.Checks = append(
p.RequiredStatusChecks.Checks,
checks := append(
*p.RequiredStatusChecks.Checks,
&github.RequiredStatusCheck{Context: "Kubernetes (v1.21.14)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.22.17)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.23.17)"},
Expand All @@ -481,12 +484,13 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
&github.RequiredStatusCheck{Context: "Kubernetes (v1.26.3)"},
&github.RequiredStatusCheck{Context: "Kubernetes (v1.27.1)"},
)
p.RequiredStatusChecks.Checks = &checks
}

if strings.EqualFold(repo, "CHANGELOG") {
// Avoid dismissing stale reviews, since delay in kodiak auto approval can fail release process.
p.RequiredPullRequestReviews.DismissStaleReviews = false
p.RequiredStatusChecks.Checks = []*github.RequiredStatusCheck{
p.RequiredStatusChecks.Checks = &[]*github.RequiredStatusCheck{
{Context: "DCO"},
}
}
Expand All @@ -495,7 +499,7 @@ func ProtectBranch(ctx context.Context, client *github.Client, owner, repo, bran
//}

if predefinedChecks, ok := requiredStatusChecks[fmt.Sprintf("%s/%s", owner, repo)]; ok {
p.RequiredStatusChecks.Checks = predefinedChecks
p.RequiredStatusChecks.Checks = &predefinedChecks
}

_, _, err := client.Repositories.UpdateBranchProtection(ctx, owner, repo, branch, p)
Expand Down
2 changes: 1 addition & 1 deletion cmds/protect_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"time"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/appscodelabs/gh-tools/internal/git"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/start_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"sort"
"strings"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
2 changes: 1 addition & 1 deletion cmds/unwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"sort"

"github.com/google/go-github/v54/github"
"github.com/google/go-github/v61/github"
"github.com/spf13/cobra"
"golang.org/x/oauth2"
"gomodules.xyz/flags"
Expand Down
28 changes: 11 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
module github.com/appscodelabs/gh-tools

go 1.18
go 1.22.0

toolchain go1.22.2

require (
github.com/apex/log v1.9.0
github.com/google/go-github/v54 v54.0.0
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.3
golang.org/x/oauth2 v0.11.0
github.com/google/go-github/v61 v61.0.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
golang.org/x/oauth2 v0.19.0
gomodules.xyz/flags v0.1.3
gomodules.xyz/logs v0.0.7
gomodules.xyz/pointer v0.1.0
gomodules.xyz/sets v0.2.1
gomodules.xyz/x v0.0.14
gomodules.xyz/x v0.0.17
)

require (
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect
gomodules.xyz/wait v0.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
)
Loading

0 comments on commit aca5e1f

Please sign in to comment.