mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-22 07:08:58 +00:00
Fix BB PR pipeline ref (#3985)
This commit is contained in:
parent
6f4ef6d18d
commit
2d6e1ea015
2 changed files with 3 additions and 2 deletions
|
@ -171,7 +171,7 @@ func convertPullHook(from *internal.PullRequestHook) *model.Pipeline {
|
|||
pipeline := &model.Pipeline{
|
||||
Event: event,
|
||||
Commit: from.PullRequest.Source.Commit.Hash,
|
||||
Ref: fmt.Sprintf("refs/heads/%s", from.PullRequest.Source.Branch.Name),
|
||||
Ref: fmt.Sprintf("refs/pull-requests/%d/from", from.PullRequest.ID),
|
||||
Refspec: fmt.Sprintf("%s:%s",
|
||||
from.PullRequest.Source.Branch.Name,
|
||||
from.PullRequest.Dest.Branch.Name,
|
||||
|
|
|
@ -133,6 +133,7 @@ func Test_helper(t *testing.T) {
|
|||
hook.PullRequest.Links.HTML.Href = "https://bitbucket.org/foo/bar/pulls/5"
|
||||
hook.PullRequest.Title = "updated README"
|
||||
hook.PullRequest.Updated = time.Now()
|
||||
hook.PullRequest.ID = 1
|
||||
|
||||
pipeline := convertPullHook(hook)
|
||||
g.Assert(pipeline.Event).Equal(model.EventPull)
|
||||
|
@ -141,7 +142,7 @@ func Test_helper(t *testing.T) {
|
|||
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Source.Commit.Hash)
|
||||
g.Assert(pipeline.Branch).Equal(hook.PullRequest.Source.Branch.Name)
|
||||
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href)
|
||||
g.Assert(pipeline.Ref).Equal("refs/heads/change")
|
||||
g.Assert(pipeline.Ref).Equal("refs/pull-requests/1/from")
|
||||
g.Assert(pipeline.Refspec).Equal("change:main")
|
||||
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
|
||||
g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix())
|
||||
|
|
Loading…
Reference in a new issue