Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server/forge/bitbucketdatacenter/bitbucketdatacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,14 @@ func (c *client) updatePipelineFromCommits(ctx context.Context, u *model.User, r
if err != nil {
return nil, fmt.Errorf("unable to read commit: %w", err)
}

// In Bitbucket Data Center, when using annotated tags, the webhook's ToHash is the tag object SHA, not the actual commit SHA.
// Update p.Commit so that build statuses are posted to the correct commit SHA.
if p.Event == model.EventTag && commit.ID != "" && commit.ID != p.Commit {
p.Commit = commit.ID
p.ForgeURL = fmt.Sprintf("%s/projects/%s/repos/%s/commits/%s", c.url, r.Owner, r.Name, commit.ID)
}

p.Message = commit.Message

opts := &bb.CompareChangesOptions{}
Expand Down