Skip to content

Commit

Permalink
Add ref to deployment webhook
Browse files Browse the repository at this point in the history
This seems to be undocumented but looking at the code always present: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/data_builder/deployment.rb#L44
  • Loading branch information
vntw committed Oct 19, 2022
1 parent 6da2d13 commit ec7a8cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions event_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type DeploymentEvent struct {
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
} `json:"project"`
Ref string `json:"ref"`
ShortSHA string `json:"short_sha"`
User *EventUser `json:"user"`
UserURL string `json:"user_url"`
Expand Down
4 changes: 4 additions & 0 deletions event_webhook_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ func TestDeploymentEventUnmarshal(t *testing.T) {
if event.CommitTitle != "Add new file" {
t.Errorf("CommitTitle is %s, want %s", event.CommitTitle, "Add new file")
}

if event.Ref != "1.0.0" {
t.Errorf("Ref is %s, want %s", event.Ref, "1.0.0")
}
}

func TestIssueCommentEventUnmarshal(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion testdata/webhooks/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
},
"user_url": "http://10.126.0.2:3000/root",
"commit_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468",
"commit_title": "Add new file"
"commit_title": "Add new file",
"ref": "1.0.0"
}

0 comments on commit ec7a8cd

Please sign in to comment.