Skip to content

Commit

Permalink
Merge pull request #1698 from smit-modi/pipeline-event
Browse files Browse the repository at this point in the history
Added detailed_merge_status in PipelineEvent
  • Loading branch information
svanharmelen committed Apr 13, 2023
2 parents 4c4f55d + afed3ef commit 55d7024
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
21 changes: 11 additions & 10 deletions event_webhook_types.go
Expand Up @@ -722,16 +722,17 @@ type PipelineEvent struct {
} `json:"variables"`
} `json:"object_attributes"`
MergeRequest struct {
ID int `json:"id"`
IID int `json:"iid"`
Title string `json:"title"`
SourceBranch string `json:"source_branch"`
SourceProjectID int `json:"source_project_id"`
TargetBranch string `json:"target_branch"`
TargetProjectID int `json:"target_project_id"`
State string `json:"state"`
MergeRequestStatus string `json:"merge_status"`
URL string `json:"url"`
ID int `json:"id"`
IID int `json:"iid"`
Title string `json:"title"`
SourceBranch string `json:"source_branch"`
SourceProjectID int `json:"source_project_id"`
TargetBranch string `json:"target_branch"`
TargetProjectID int `json:"target_project_id"`
State string `json:"state"`
MergeRequestStatus string `json:"merge_status"`
DetailedMergeStatus string `json:"detailed_merge_status"`
URL string `json:"url"`
} `json:"merge_request"`
User *EventUser `json:"user"`
Project struct {
Expand Down
4 changes: 4 additions & 0 deletions event_webhook_types_test.go
Expand Up @@ -711,6 +711,10 @@ func TestPipelineEventUnmarshal(t *testing.T) {
if event.SourcePipline.Project.ID != 41 {
t.Errorf("Source Pipline Project ID is %v, want %v", event.SourcePipline.Project.ID, 41)
}

if event.MergeRequest.DetailedMergeStatus != "mergeable" {
t.Errorf("MergeRequest.DetailedMergeStatus is %v, want %v", event.MergeRequest.DetailedMergeStatus, "mergeable")
}
}

func TestPushEventUnmarshal(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions testdata/webhooks/pipeline.json
Expand Up @@ -35,6 +35,7 @@
"target_project_id": 1,
"state": "opened",
"merge_status": "can_be_merged",
"detailed_merge_status": "mergeable",
"url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1"
},
"user": {
Expand Down

0 comments on commit 55d7024

Please sign in to comment.