Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ bin/

cmd/app/__debug*

.idea/
mise.local.toml

43 changes: 19 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
module repo

go 1.24
go 1.26

require (
github.com/knadh/koanf/providers/posflag v1.0.1
github.com/logrusorgru/aurora/v4 v4.0.0 // indirect
github.com/slack-go/slack v0.9.1
github.com/spf13/cobra v1.1.3
github.com/xanzy/go-gitlab v0.115.0
github.com/logrusorgru/aurora/v4 v4.0.0
github.com/slack-go/slack v0.26.0
github.com/spf13/cobra v1.10.2
gitlab.com/gitlab-org/api/client-go/v2 v2.39.0
go.yaml.in/yaml/v3 v3.0.4 // indirect
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/go-querystring v1.2.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/knadh/koanf/maps v0.1.2 // indirect
github.com/knadh/koanf/parsers/yaml v1.0.0
github.com/knadh/koanf/parsers/yaml v1.1.0
github.com/knadh/koanf/providers/env v1.1.0
github.com/knadh/koanf/providers/file v1.2.0
github.com/knadh/koanf/providers/file v1.2.1
github.com/knadh/koanf/providers/structs v1.0.0
github.com/knadh/koanf/v2 v2.2.1
github.com/knadh/koanf/v2 v2.3.5
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/spf13/pflag v1.0.6
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.29.1 // indirect
github.com/spf13/pflag v1.0.10
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/time v0.15.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
374 changes: 45 additions & 329 deletions go.sum

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions internal/hoster/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import (
"repo/internal/notification"
"repo/internal/say"

"github.com/xanzy/go-gitlab"
gg "github.com/xanzy/go-gitlab"
gg "gitlab.com/gitlab-org/api/client-go/v2"
)

func MakeHoster() (*Gitlab, error) {
Expand All @@ -26,7 +25,7 @@ func MakeHoster() (*Gitlab, error) {
}

var errClient error
result.client, errClient = gg.NewClient(config.Values.Gitlab.ApiToken, gitlab.WithBaseURL("https://"+result.Host()))
result.client, errClient = gg.NewClient(config.Values.Gitlab.ApiToken, gg.WithBaseURL("https://"+result.Host()))
if errClient != nil {
return nil, errClient
}
Expand All @@ -48,8 +47,8 @@ func (g Gitlab) Repositories(options hoster.RequestOptions) []hoster.HosterRepos
PerPage: 100,
Page: 1,
},
Archived: gg.Bool(false),
Membership: gg.Bool(true),
Archived: new(false),
Membership: new(true),
Starred: &options.Starred,
//TODO include topics here to reduce query time
}
Expand Down Expand Up @@ -105,7 +104,7 @@ func matchesPattern(value string, patterns []string, expected bool, anyMatch boo
return result
}

func matches(options hoster.RequestOptions, path string, tags []string, projectAcl gitlab.AccessControlValue) bool {
func matches(options hoster.RequestOptions, path string, tags []string, projectAcl gg.AccessControlValue) bool {
if projectAcl == "disabled" {
say.Verbose("Skipping repository with disabled git repository acl")
return false
Expand Down Expand Up @@ -265,7 +264,7 @@ func (g Gitlab) DownloadRepoyaml(remotePath string, branch string) (*model.RepoY

func downloadFile(g Gitlab, remotePath string, branch string) (*gg.File, error) {
gfo := &gg.GetFileOptions{
Ref: gg.String(branch),
Ref: &branch,
}

var file *gg.File
Expand Down
4 changes: 2 additions & 2 deletions internal/hoster/gitlab/gitlab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"repo/internal/hoster"
"testing"

"github.com/xanzy/go-gitlab"
gg "gitlab.com/gitlab-org/api/client-go/v2"
)

type matchCase struct {
Expand Down Expand Up @@ -64,7 +64,7 @@ var matchCases = []matchCase{

func TestMatches(t *testing.T) {
for _, test := range matchCases {
got := matches(test.options, test.path, test.tags, *gitlab.AccessControl("enabled"))
got := matches(test.options, test.path, test.tags, gg.EnabledAccessControl)
if got != test.expected {
t.Errorf("got %t, wanted %t for %v", got, test.expected, test)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/hoster/hoster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Hoster interface {
}

type HosterRepository struct {
Id int
Id int64
Name string
Path string
PathWithNamespace string
Expand Down
2 changes: 1 addition & 1 deletion internal/model/repoyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Gitlab struct {
WikiAccessLevel *string `yaml:"wiki_access_level"`
IssuesAccessLevel *string `yaml:"issues_access_level"`
ForkingAccessLevel *string `yaml:"forking_access_level"`
BuildTimeOut *int `yaml:"build_timeout"`
BuildTimeOut *int64 `yaml:"build_timeout"`

OnlyAllowMergeIfPipelineSucceeds *bool `yaml:"only_allow_merge_if_pipeline_succeeds"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `yaml:"only_allow_merge_if_all_discussions_are_resolved"`
Expand Down
32 changes: 16 additions & 16 deletions mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
go = "1.26.1"
go = "1.26.4"
Loading