Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-09-30 01:18:30 +03:00
parent 67058f3883
commit 3988e81157

View File

@ -27,7 +27,7 @@ import (
var ( var (
DefaultPullRequestTitle = `Bump {{.Name}} from {{.VersionOld}} to {{.VersionNew}}` DefaultPullRequestTitle = `Bump {{.Name}} from {{.VersionOld}} to {{.VersionNew}}`
DefaultPullRequestBody = `Bumps {{.Name}} from {{.VersionOld}} to {{.VersionNew}}.` DefaultPullRequestBody = `Bumps {{.Name}} from {{.VersionOld}} to {{.VersionNew}}`
) )
type Config struct { type Config struct {
@ -219,6 +219,10 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules.
logger.Fatalf(ctx, "failed to create repo branch: %v", err) logger.Fatalf(ctx, "failed to create repo branch: %v", err)
} }
if err = repo.Push(&git.PushOptions{}); err != nil {
logger.Fatalf(ctx, "failed to push repo branch: %v", err)
}
data := map[string]string{ data := map[string]string{
"Name": path, "Name": path,
"VersionOld": mod.Module.Version, "VersionOld": mod.Module.Version,
@ -246,16 +250,6 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules.
} }
logger.Infof(ctx, "marshal body: %s", buf) logger.Infof(ctx, "marshal body: %s", buf)
/*
'https://try.gitea.io/api/v1/repos/org/repo/pulls?token=myaccesstoken' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"base": "main",
"body": "This is a PR",
"head": "username:feature-branch",
"title": "PR title"
*/
req, err := http.NewRequestWithContext(ctx, http.MethodPost, envAPIURL+"/repos/"+envREPOSITORY+"/pulls?token="+envTOKEN, bytes.NewReader(buf)) req, err := http.NewRequestWithContext(ctx, http.MethodPost, envAPIURL+"/repos/"+envREPOSITORY+"/pulls?token="+envTOKEN, bytes.NewReader(buf))
if err != nil { if err != nil {