fix(bitbucketdc): build status not reported on PR builds (#5162)

Co-authored-by: Ratko Ruzicic <ratko.ruzicic@oaklandgrp.com>
This commit is contained in:
Ratko Ružičić 2025-05-13 17:29:00 +02:00 committed by GitHub
parent 0a22070400
commit 1f23da379e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -119,7 +119,7 @@ func convertPullRequestEvent(ev *bb.PullRequestEvent, baseURL string) *model.Pip
Author: authorLabel(ev.Actor.Name), Author: authorLabel(ev.Actor.Name),
Email: ev.Actor.Email, Email: ev.Actor.Email,
Timestamp: time.Time(ev.Date).UTC().Unix(), Timestamp: time.Time(ev.Date).UTC().Unix(),
Ref: fmt.Sprintf("refs/pull-requests/%d/from", ev.PullRequest.ID), Ref: ev.PullRequest.Source.ID,
ForgeURL: fmt.Sprintf("%s/projects/%s/repos/%s/commits/%s", baseURL, ev.PullRequest.Source.Repository.Project.Key, ev.PullRequest.Source.Repository.Slug, ev.PullRequest.Source.Latest), ForgeURL: fmt.Sprintf("%s/projects/%s/repos/%s/commits/%s", baseURL, ev.PullRequest.Source.Repository.Project.Key, ev.PullRequest.Source.Repository.Slug, ev.PullRequest.Source.Latest),
Refspec: fmt.Sprintf("%s:%s", ev.PullRequest.Source.DisplayID, ev.PullRequest.Target.DisplayID), Refspec: fmt.Sprintf("%s:%s", ev.PullRequest.Source.DisplayID, ev.PullRequest.Target.DisplayID),
FromFork: ev.PullRequest.Source.Repository.ID != ev.PullRequest.Target.Repository.ID, FromFork: ev.PullRequest.Source.Repository.ID != ev.PullRequest.Target.Repository.ID,

View file

@ -218,7 +218,7 @@ func Test_convertPullRequestEvent(t *testing.T) {
Author: "John Doe", Author: "John Doe",
Email: "john.doe@mail.com", Email: "john.doe@mail.com",
Timestamp: now.UTC().Unix(), Timestamp: now.UTC().Unix(),
Ref: "refs/pull-requests/123/from", Ref: "refs/head/branch",
ForgeURL: "https://base.url/projects/PRJ/repos/REPO/commits/1234567890abcdef", ForgeURL: "https://base.url/projects/PRJ/repos/REPO/commits/1234567890abcdef",
Event: model.EventPull, Event: model.EventPull,
Refspec: "branch:main", Refspec: "branch:main",
@ -273,7 +273,7 @@ func Test_convertPullRequestCloseEvent(t *testing.T) {
Author: "John Doe", Author: "John Doe",
Email: "john.doe@mail.com", Email: "john.doe@mail.com",
Timestamp: now.UTC().Unix(), Timestamp: now.UTC().Unix(),
Ref: "refs/pull-requests/123/from", Ref: "refs/head/branch",
ForgeURL: "https://base.url/projects/PRJ/repos/REPO/commits/1234567890abcdef", ForgeURL: "https://base.url/projects/PRJ/repos/REPO/commits/1234567890abcdef",
Event: model.EventPullClosed, Event: model.EventPullClosed,
Refspec: "branch:main", Refspec: "branch:main",