From 4eaed8781b5daf94a64479dce559696570fc548a Mon Sep 17 00:00:00 2001 From: Gorbunov Kirill Andreevich Date: Sun, 31 Mar 2024 16:12:56 +0300 Subject: [PATCH] #8 delete parse env in gitea. --- cmd/pkgdashcli/main.go | 4 ++-- internal/source/gitea/gitea.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 9836dcb..d67b6a0 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -257,6 +257,7 @@ func Execute(ctx context.Context, gitSource source.SourceControl, mvs map[string } } logger.Debugf(ctx, fmt.Sprintf("Update successful for %s", path)) + return } for _, branch := range cfg.Branches { // update all dep for path, mod = range mvs { @@ -278,6 +279,7 @@ func Execute(ctx context.Context, gitSource source.SourceControl, mvs map[string } } logger.Debugf(ctx, fmt.Sprintf("Close successful for %s", path)) + return } for _, branch := range cfg.Branches { logger.Info(ctx, fmt.Sprintf("Start getting pr for %s", branch)) @@ -335,7 +337,6 @@ func getRepoMgmt(ctx context.Context, cfg *configcli.Config) error { if err != nil { logger.Fatal(ctx, fmt.Sprintf("pkgdash/main can t get info about user: %s", err)) } - n, err := netrc.Parse(filepath.Join(usr.HomeDir, ".netrc")) if err != nil { logger.Error(ctx, "pkgdash/main can t parse .netrc: %s", err) @@ -347,7 +348,6 @@ func getRepoMgmt(ctx context.Context, cfg *configcli.Config) error { if cfg.Source.Token == "" { cfg.Source.Token = n.Machine(cfg.Source.APIURL).Get("password") } - return nil } diff --git a/internal/source/gitea/gitea.go b/internal/source/gitea/gitea.go index 796f344..201fccf 100644 --- a/internal/source/gitea/gitea.go +++ b/internal/source/gitea/gitea.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "net/http" - "os" "os/exec" "regexp" "strings" @@ -39,7 +38,7 @@ type Gitea struct { func NewGitea(cfg configcli.Config) *Gitea { return &Gitea{ URL: cfg.Source.APIURL, - Token: os.Getenv("gitea_token"), + Token: cfg.Source.Token, PRTitle: cfg.PullRequestTitle, PRBody: cfg.PullRequestBody, Repository: cfg.Source.Repository,