Skip to content

Commit

Permalink
Merge pull request #1565 from vntw/deploy-hook-ref
Browse files Browse the repository at this point in the history
 Add `ref` to deployment webhook
  • Loading branch information
svanharmelen committed Oct 29, 2022
2 parents df0fd38 + decc7fe commit 1114045
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions event_webhook_types.go
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 Expand Up @@ -305,8 +306,7 @@ type IssueEvent struct {
// JobEvent represents a job event.
//
// GitLab API docs:
// TODO: link to docs instead of src once they are published.
// https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/data_builder/build.rb
// https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#job-events
type JobEvent struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Expand Down
4 changes: 4 additions & 0 deletions event_webhook_types_test.go
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
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 1114045

Please sign in to comment.