diff --git a/server/forge/gitea/helper.go b/server/forge/gitea/helper.go index 56ec0953e..451287211 100644 --- a/server/forge/gitea/helper.go +++ b/server/forge/gitea/helper.go @@ -160,7 +160,7 @@ func pipelineFromPullRequest(hook *pullRequestHook) *model.Pipeline { Commit: hook.PullRequest.Head.Sha, ForgeURL: hook.PullRequest.HTMLURL, Ref: fmt.Sprintf("refs/pull/%d/head", hook.Number), - Branch: hook.PullRequest.Base.Ref, + Branch: hook.PullRequest.Head.Ref, Message: hook.PullRequest.Title, Author: hook.PullRequest.Poster.UserName, Avatar: avatar, diff --git a/server/forge/github/parse.go b/server/forge/github/parse.go index 61084d857..7bc8854b7 100644 --- a/server/forge/github/parse.go +++ b/server/forge/github/parse.go @@ -164,7 +164,7 @@ func parsePullHook(hook *github.PullRequestEvent, merge bool) (*github.PullReque Commit: hook.GetPullRequest().GetHead().GetSHA(), ForgeURL: hook.GetPullRequest().GetHTMLURL(), Ref: fmt.Sprintf(headRefs, hook.GetPullRequest().GetNumber()), - Branch: hook.GetPullRequest().GetBase().GetRef(), + Branch: hook.GetPullRequest().GetHead().GetRef(), Message: hook.GetPullRequest().GetTitle(), Author: hook.GetPullRequest().GetUser().GetLogin(), Avatar: hook.GetPullRequest().GetUser().GetAvatarURL(), diff --git a/server/forge/gitlab/convert.go b/server/forge/gitlab/convert.go index dab74fbc8..688744170 100644 --- a/server/forge/gitlab/convert.go +++ b/server/forge/gitlab/convert.go @@ -106,7 +106,7 @@ func convertMergeRequestHook(hook *gitlab.MergeEvent, req *http.Request) (int, * repo.CloneSSH = target.SSHURL } - repo.Branch = target.DefaultBranch + repo.Branch = hook.ObjectAttributes.SourceBranch if target.AvatarURL != "" { repo.Avatar = target.AvatarURL