Skip to content

Commit

Permalink
fix: set github client
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Oct 10, 2023
1 parent 08d8ef3 commit a922c77
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pkg/controller/update/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type Controller struct {
github RepositoriesService
gh RepositoriesService
rootDir string
configFinder ConfigFinder
configReader reader.ConfigReader
Expand All @@ -28,8 +28,9 @@ type RepositoriesService interface {
ListTags(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
}

func New(param *config.Param, configFinder ConfigFinder, configReader reader.ConfigReader, registInstaller registry.Installer, fs afero.Fs, rt *runtime.Runtime) *Controller {
func New(param *config.Param, gh RepositoriesService, configFinder ConfigFinder, configReader reader.ConfigReader, registInstaller registry.Installer, fs afero.Fs, rt *runtime.Runtime) *Controller {
return &Controller{
gh: gh,
rootDir: param.RootDir,
configFinder: configFinder,
configReader: configReader,
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/update/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (c *Controller) newRegistryVersion(ctx context.Context, logE *logrus.Entry,
}

logE.Debug("getting the latest release")
release, _, err := c.github.GetLatestRelease(ctx, rgst.RepoOwner, rgst.RepoName)
release, _, err := c.gh.GetLatestRelease(ctx, rgst.RepoOwner, rgst.RepoName)
if err != nil {
return "", fmt.Errorf("get the latest release by GitHub API: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ func InitializeUpdateCommandController(ctx context.Context, param *config.Param,
wire.NewSet(
github.New,
wire.Bind(new(github.RepositoriesService), new(*github.RepositoriesServiceImpl)),
wire.Bind(new(update.RepositoriesService), new(*github.RepositoriesServiceImpl)),
wire.Bind(new(download.GitHubContentAPI), new(*github.RepositoriesServiceImpl)),
),
wire.NewSet(
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/wire_gen.go

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

0 comments on commit a922c77

Please sign in to comment.