fixup deps

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-10-02 01:16:16 +03:00
parent 1c9a6126f3
commit 8da137e29b

View File

@ -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)
}