This commit is contained in:
Adam Majer 2024-07-10 11:18:33 +02:00
parent 6b3abaa4d6
commit 6e501c82bc

View File

@ -16,7 +16,7 @@ import (
func (h *RequestHandler) allocateGiteaTransport() *transport.Runtime { func (h *RequestHandler) allocateGiteaTransport() *transport.Runtime {
r := transport.New("src.opensuse.org", apiclient.DefaultBasePath, [](string){"https"}) r := transport.New("src.opensuse.org", apiclient.DefaultBasePath, [](string){"https"})
r.DefaultAuthentication = transport.BearerToken(h.GiteaToken) r.DefaultAuthentication = transport.BearerToken(h.GiteaToken)
// r.SetDebug(true) r.SetDebug(true)
return r return r
} }
@ -116,11 +116,13 @@ func (h *RequestHandler) CreatePullRequest(repo *models.Repository, srcId, targe
if err != nil { if err != nil {
h.LogError("Cannot create pull request: %v", err) h.LogError("Cannot create pull request: %v", err)
h.Error = err h.Error = err
return nil
} }
if !pr.IsSuccess() { if !pr.IsSuccess() {
h.LogError("PR creation failed: %s", pr.Error()) h.LogError("PR creation failed: %s", pr.Error())
h.Error = errors.New(pr.Error()) h.Error = errors.New(pr.Error())
return nil
} }
return pr.GetPayload() return pr.GetPayload()