Use Bitbucket PR title for pipeline message (#3984)

This commit is contained in:
Joan Flotats 2024-07-30 20:37:33 +02:00 committed by GitHub
parent 2d039f85cb
commit ec02379b04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -178,7 +178,7 @@ func convertPullHook(from *internal.PullRequestHook) *model.Pipeline {
), ),
ForgeURL: from.PullRequest.Links.HTML.Href, ForgeURL: from.PullRequest.Links.HTML.Href,
Branch: from.PullRequest.Source.Branch.Name, Branch: from.PullRequest.Source.Branch.Name,
Message: from.PullRequest.Desc, Message: from.PullRequest.Title,
Avatar: from.Actor.Links.Avatar.Href, Avatar: from.Actor.Links.Avatar.Href,
Author: from.Actor.Login, Author: from.Actor.Login,
Sender: from.Actor.Login, Sender: from.Actor.Login,

View file

@ -131,7 +131,7 @@ func Test_helper(t *testing.T) {
hook.PullRequest.Source.Repo.FullName = "baz/bar" hook.PullRequest.Source.Repo.FullName = "baz/bar"
hook.PullRequest.Source.Commit.Hash = "c8411d7" hook.PullRequest.Source.Commit.Hash = "c8411d7"
hook.PullRequest.Links.HTML.Href = "https://bitbucket.org/foo/bar/pulls/5" hook.PullRequest.Links.HTML.Href = "https://bitbucket.org/foo/bar/pulls/5"
hook.PullRequest.Desc = "updated README" hook.PullRequest.Title = "updated README"
hook.PullRequest.Updated = time.Now() hook.PullRequest.Updated = time.Now()
pipeline := convertPullHook(hook) pipeline := convertPullHook(hook)
@ -143,7 +143,7 @@ func Test_helper(t *testing.T) {
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href) g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href)
g.Assert(pipeline.Ref).Equal("refs/heads/change") g.Assert(pipeline.Ref).Equal("refs/heads/change")
g.Assert(pipeline.Refspec).Equal("change:main") g.Assert(pipeline.Refspec).Equal("change:main")
g.Assert(pipeline.Message).Equal(hook.PullRequest.Desc) g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix()) g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix())
}) })