From 8da137e29bafddbdc09b0773c3be97124b9d4d3e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 2 Oct 2023 01:16:16 +0300 Subject: [PATCH] fixup deps Signed-off-by: Vasiliy Tolstov --- cmd/pkgdashcli/main.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index a6e79b2..0185a66 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -16,6 +16,7 @@ import ( "git.unistack.org/unistack-org/pkgdash/internal/modules" "github.com/go-git/go-git/v5" + gitconfig "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" httpauth "github.com/go-git/go-git/v5/plumbing/transport/http" @@ -219,9 +220,9 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules. wBody.Reset() fmt.Printf("%s from %s to %s\n", path, mod.Module.Version, mod.Version) - ref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), headRef.Hash()) + newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), headRef.Hash()) - if err = repo.Storer.SetReference(ref); err != nil { + if err = repo.Storer.SetReference(newref); err != nil { logger.Fatalf(ctx, "failed to create repo branch: %v", err) } @@ -260,7 +261,7 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules. _, err = wtree.Commit(wTitle.String(), &git.CommitOptions{ Author: &object.Signature{ - Name: "pkgdash", + Name: "gitea-actions ", Email: "info@unistack.org", When: time.Now(), }, @@ -269,7 +270,10 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules. logger.Fatalf(ctx, "failed to commit: %v", err) } - if err = repo.Push(&git.PushOptions{Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN}}); err != nil { + if err = repo.Push(&git.PushOptions{ + RefSpecs: []gitconfig.RefSpec{gitconfig.RefSpec(newref.String())}, + Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN}, + }); err != nil { logger.Fatalf(ctx, "failed to push repo branch: %v", err) }