Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ref to deployment webhook #1565

Merged
merged 2 commits into from Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
}