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

Added UserUsername (sic) to tag push events. #1183

Merged
merged 1 commit into from
Jul 28, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion event_parsing_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ func TestParseTagHook(t *testing.T) {
}

if event.UserName != exampleEventUserName {
t.Errorf("Username is %s, want %s", event.UserName, exampleEventUserName)
t.Errorf("Name is %s, want %s", event.UserName, exampleEventUserName)
}

if event.UserUsername != exampleEventUserUsername {
t.Errorf("Username is %s, want %s", event.UserUsername, exampleEventUserUsername)
}

if event.Ref != "refs/tags/v1.0.0" {
Expand Down
25 changes: 13 additions & 12 deletions event_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,18 +855,19 @@ type SnippetCommentEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#tag-events
type TagEvent struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSHA string `json:"checkout_sha"`
UserID int `json:"user_id"`
UserName string `json:"user_name"`
UserAvatar string `json:"user_avatar"`
UserEmail string `json:"user_email"`
ProjectID int `json:"project_id"`
Message string `json:"message"`
Project struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSHA string `json:"checkout_sha"`
UserID int `json:"user_id"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserAvatar string `json:"user_avatar"`
UserEmail string `json:"user_email"`
ProjectID int `json:"project_id"`
Message string `json:"message"`
Project struct {
Name string `json:"name"`
Description string `json:"description"`
AvatarURL string `json:"avatar_url"`
Expand Down
5 changes: 4 additions & 1 deletion fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ const (
"locked": false
}`

// exampleEventUserName provides a fixture for a event username.
// exampleEventUserName provides a fixture for a event user's name.
exampleEventUserName = "John Smith"

// exampleEventUserUsername provides a ficture for the event username.
exampleEventUserUsername = "jsmith"

// exampleProjectName provides a fixture for a project name.
exampleProjectName = "example-project"

Expand Down
1 change: 1 addition & 0 deletions testdata/webhooks/tag_push.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ref": "refs/tags/v1.0.0",
"checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
"user_id": 1,
"user_username": "jsmith",
"user_name": "John Smith",
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
"project_id": 1,
Expand Down