Skip to content

Commit

Permalink
Add Topics to EditChange struct (#3057)
Browse files Browse the repository at this point in the history
Fixes: #3056.
  • Loading branch information
riaje committed Jan 24, 2024
1 parent b61795d commit 20fc901
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"`
Expand Down
9 changes: 9 additions & 0 deletions github/event_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,22 @@ func TestEditChange_Marshal_Repo(t *testing.T) {
From: String("old-repo-name"),
},
},
Topics: &EditTopics{
From: []string{"topic1", "topic2"},
},
}

want := `{
"repository": {
"name": {
"from": "old-repo-name"
}
},
"topics": {
"from": [
"topic1",
"topic2"
]
}
}`

Expand Down
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 20fc901

Please sign in to comment.