Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1406 from chmouel/add-note-merge-comment-event
Browse files Browse the repository at this point in the history
Add Title to MergeCommentEvent.LastCommit struct
  • Loading branch information
svanharmelen authored Mar 10, 2022
2 parents b3f55a4 + 36dd73c commit bd30483
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions event_parsing_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ func TestParseMergeRequestCommentHook(t *testing.T) {
if event.MergeRequest.ID != 7 {
t.Errorf("MergeRequest ID is %v, want %v", event.MergeRequest.ID, 7)
}

expectedTitle := "Merge branch 'another-branch' into 'master'"
if event.MergeRequest.LastCommit.Title != expectedTitle {
t.Errorf("MergeRequest Title is %v, want %v", event.MergeRequest.Title, expectedTitle)
}
}

func TestParseMergeRequestHook(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions event_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ type MergeCommentEvent struct {
Target *Repository `json:"target"`
LastCommit struct {
ID string `json:"id"`
Title string `json:"title"`
Message string `json:"message"`
Timestamp *time.Time `json:"timestamp"`
URL string `json:"url"`
Expand Down
1 change: 1 addition & 0 deletions testdata/webhooks/note_merge_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"last_commit": {
"id": "562e173be03b8ff2efb05345d12df18815438a4b",
"message": "Merge branch 'another-branch' into 'master'\n\nCheck in this test\n",
"title": "Merge branch 'another-branch' into 'master'",
"timestamp": "2015-04-08T21:00:25-07:00",
"url": "http://example.com/gitlab-org/gitlab-test/commit/562e173be03b8ff2efb05345d12df18815438a4b",
"author": {
Expand Down

0 comments on commit bd30483

Please sign in to comment.