diff --git a/server/events/vcs/gitlab_client.go b/server/events/vcs/gitlab_client.go index feeacc3573..26eb93f223 100644 --- a/server/events/vcs/gitlab_client.go +++ b/server/events/vcs/gitlab_client.go @@ -249,6 +249,7 @@ func (g *GitlabClient) UpdateStatus(repo models.Repo, pull models.PullRequest, s Context: gitlab.String(src), Description: gitlab.String(description), TargetURL: &url, + Ref: gitlab.String(pull.HeadBranch), }) return err } diff --git a/server/events/vcs/gitlab_client_test.go b/server/events/vcs/gitlab_client_test.go index cd16009d0e..bbc6ace218 100644 --- a/server/events/vcs/gitlab_client_test.go +++ b/server/events/vcs/gitlab_client_test.go @@ -212,7 +212,7 @@ func TestGitlabClient_UpdateStatus(t *testing.T) { body, err := io.ReadAll(r.Body) Ok(t, err) - exp := fmt.Sprintf(`{"state":"%s","context":"src","target_url":"https://google.com","description":"description"}`, c.expState) + exp := fmt.Sprintf(`{"state":"%s","ref":"test","context":"src","target_url":"https://google.com","description":"description"}`, c.expState) Equals(t, exp, string(body)) defer r.Body.Close() // nolint: errcheck w.Write([]byte("{}")) // nolint: errcheck @@ -241,6 +241,7 @@ func TestGitlabClient_UpdateStatus(t *testing.T) { Num: 1, BaseRepo: repo, HeadCommit: "sha", + HeadBranch: "test", }, c.status, "src", "description", "https://google.com") Ok(t, err) Assert(t, gotRequest, "expected to get the request")