diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 348b215..ae2cb2f 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -225,6 +225,8 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ logger.Fatalf(ctx, "failed to get repo head: %v", err) } + logger.Infof(ctx, "repo head %s", headRef) + wtree, err := repo.Worktree() if err != nil { logger.Fatalf(ctx, "failed to get worktree: %v", err) @@ -281,10 +283,12 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ logger.Fatalf(ctx, "failed to reset repo branch: %v", err) } - logger.Infof(ctx, "checkout ref %s", headRef) + newbranch := fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version) + logger.Infof(ctx, "checkout ref %s to %s", headRef) if err = wtree.Checkout(&git.CheckoutOptions{ Hash: headRef.Hash(), - Create: false, + Branch: newbranch, + Create: true, Force: true, }); err != nil { logger.Fatalf(ctx, "failed to get checkout tree: %v", err) @@ -323,6 +327,7 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[ logger.Infof(ctx, "worktree commit") commit, err := wtree.Commit(wTitle.String(), &git.CommitOptions{ + Parents: []plumbing.Hash{headRef.Hash()}, Author: &object.Signature{ Name: "gitea-actions", Email: "info@unistack.org",