Skip to content

Commit

Permalink
Remove GenerateReleaseNotes from RepositoriesService.EditRelease (#2445)
Browse files Browse the repository at this point in the history
Fixes: #2444.
  • Loading branch information
coro authored Sep 5, 2022
1 parent 6e95126 commit e8cac35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
5 changes: 3 additions & 2 deletions github/repos_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ type RepositoryRelease struct {
Draft *bool `json:"draft,omitempty"`
Prerelease *bool `json:"prerelease,omitempty"`
DiscussionCategoryName *string `json:"discussion_category_name,omitempty"`
GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"`

// The following fields are not used in EditRelease:
GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"`

// The following fields are not used in CreateRelease or EditRelease:
ID *int64 `json:"id,omitempty"`
Expand Down Expand Up @@ -228,7 +230,6 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin
Draft: release.Draft,
Prerelease: release.Prerelease,
DiscussionCategoryName: release.DiscussionCategoryName,
GenerateReleaseNotes: release.GenerateReleaseNotes,
}

req, err := s.client.NewRequest("PATCH", u, releaseReq)
Expand Down
27 changes: 13 additions & 14 deletions github/repos_releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,20 @@ func TestRepositoriesService_EditRelease(t *testing.T) {
input := &RepositoryRelease{
Name: String("n"),
DiscussionCategoryName: String("General"),
GenerateReleaseNotes: Bool(true),
// Fields to be removed:
ID: Int64(2),
CreatedAt: &Timestamp{referenceTime},
PublishedAt: &Timestamp{referenceTime},
URL: String("http://url/"),
HTMLURL: String("http://htmlurl/"),
AssetsURL: String("http://assetsurl/"),
Assets: []*ReleaseAsset{{ID: Int64(5)}},
UploadURL: String("http://uploadurl/"),
ZipballURL: String("http://zipballurl/"),
TarballURL: String("http://tarballurl/"),
Author: &User{Name: String("octocat")},
NodeID: String("nodeid"),
GenerateReleaseNotes: Bool(true),
ID: Int64(2),
CreatedAt: &Timestamp{referenceTime},
PublishedAt: &Timestamp{referenceTime},
URL: String("http://url/"),
HTMLURL: String("http://htmlurl/"),
AssetsURL: String("http://assetsurl/"),
Assets: []*ReleaseAsset{{ID: Int64(5)}},
UploadURL: String("http://uploadurl/"),
ZipballURL: String("http://zipballurl/"),
TarballURL: String("http://tarballurl/"),
Author: &User{Name: String("octocat")},
NodeID: String("nodeid"),
}

mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -297,7 +297,6 @@ func TestRepositoriesService_EditRelease(t *testing.T) {
want := &repositoryReleaseRequest{
Name: String("n"),
DiscussionCategoryName: String("General"),
GenerateReleaseNotes: Bool(true),
}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
Expand Down

0 comments on commit e8cac35

Please sign in to comment.