diff --git a/github/event_types.go b/github/event_types.go index db7c7c69efe..56db9f5b18c 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -394,6 +394,7 @@ type EditChange struct { Repo *EditRepo `json:"repository,omitempty"` Owner *EditOwner `json:"owner,omitempty"` DefaultBranch *EditDefaultBranch `json:"default_branch,omitempty"` + Topics *EditTopics `json:"topics,omitempty"` } // EditTitle represents a pull-request title change. @@ -438,6 +439,11 @@ type RepoName struct { From *string `json:"from,omitempty"` } +// EditTopics represents a change of repository topics. +type EditTopics struct { + From []string `json:"from,omitempty"` +} + // EditSHA represents a sha change of a pull-request. type EditSHA struct { From *string `json:"from,omitempty"` diff --git a/github/event_types_test.go b/github/event_types_test.go index 80eca61d0fc..8578b922bf6 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -91,6 +91,9 @@ func TestEditChange_Marshal_Repo(t *testing.T) { From: String("old-repo-name"), }, }, + Topics: &EditTopics{ + From: []string{"topic1", "topic2"}, + }, } want := `{ @@ -98,6 +101,12 @@ func TestEditChange_Marshal_Repo(t *testing.T) { "name": { "from": "old-repo-name" } + }, + "topics": { + "from": [ + "topic1", + "topic2" + ] } }` diff --git a/github/github-accessors.go b/github/github-accessors.go index 5a763df1e21..6d32908ce01 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6358,6 +6358,14 @@ func (e *EditChange) GetTitle() *EditTitle { return e.Title } +// GetTopics returns the Topics field. +func (e *EditChange) GetTopics() *EditTopics { + if e == nil { + return nil + } + return e.Topics +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (e *EditDefaultBranch) GetFrom() string { if e == nil || e.From == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 5c291306ab2..5856cc7ac25 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7414,6 +7414,13 @@ func TestEditChange_GetTitle(tt *testing.T) { e.GetTitle() } +func TestEditChange_GetTopics(tt *testing.T) { + e := &EditChange{} + e.GetTopics() + e = nil + e.GetTopics() +} + func TestEditDefaultBranch_GetFrom(tt *testing.T) { var zeroValue string e := &EditDefaultBranch{From: &zeroValue}