diff --git a/server/forge/bitbucket/bitbucket.go b/server/forge/bitbucket/bitbucket.go index 3cdb735b9..8dadee19e 100644 --- a/server/forge/bitbucket/bitbucket.go +++ b/server/forge/bitbucket/bitbucket.go @@ -327,6 +327,11 @@ func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, Key: common.GetPipelineStatusContext(repo, pipeline, workflow), URL: common.GetPipelineStatusURL(repo, pipeline, workflow), } + + if pipeline.Event == model.EventPush || pipeline.IsPullRequest() { + status.Refname = pipeline.Branch + } + return c.newClient(ctx, user).CreateStatus(repo.Owner, repo.Name, pipeline.Commit, &status) } diff --git a/server/forge/bitbucket/internal/types.go b/server/forge/bitbucket/internal/types.go index ca38c0e98..d2b9f96e0 100644 --- a/server/forge/bitbucket/internal/types.go +++ b/server/forge/bitbucket/internal/types.go @@ -52,11 +52,12 @@ type WorkspacesResp struct { } type PipelineStatus struct { - State string `json:"state"` - Key string `json:"key"` - Name string `json:"name,omitempty"` - URL string `json:"url"` - Desc string `json:"description,omitempty"` + State string `json:"state"` + Key string `json:"key"` + Name string `json:"name,omitempty"` + URL string `json:"url"` + Desc string `json:"description,omitempty"` + Refname string `json:"refname,omitempty"` } type Email struct {