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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MakeLatest parameter to support explicitly setting latest release #2594

Merged
merged 3 commits into from
Dec 8, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

10 changes: 10 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.

3 changes: 2 additions & 1 deletion github/github-stringify_test.go

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

17 changes: 11 additions & 6 deletions github/repos_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import (

// RepositoryRelease represents a GitHub release in a repository.
type RepositoryRelease struct {
TagName *string `json:"tag_name,omitempty"`
TargetCommitish *string `json:"target_commitish,omitempty"`
Name *string `json:"name,omitempty"`
Body *string `json:"body,omitempty"`
Draft *bool `json:"draft,omitempty"`
Prerelease *bool `json:"prerelease,omitempty"`
TagName *string `json:"tag_name,omitempty"`
TargetCommitish *string `json:"target_commitish,omitempty"`
Name *string `json:"name,omitempty"`
Body *string `json:"body,omitempty"`
Draft *bool `json:"draft,omitempty"`
Prerelease *bool `json:"prerelease,omitempty"`
// MakeLatest can be one of: "true", "false", or "legacy".
MakeLatest *string `json:"make_latest,omitempty"`
chrisgrautealium marked this conversation as resolved.
Show resolved Hide resolved
DiscussionCategoryName *string `json:"discussion_category_name,omitempty"`

// The following fields are not used in EditRelease:
Expand Down Expand Up @@ -176,6 +178,7 @@ type repositoryReleaseRequest struct {
Body *string `json:"body,omitempty"`
Draft *bool `json:"draft,omitempty"`
Prerelease *bool `json:"prerelease,omitempty"`
MakeLatest *string `json:"make_latest,omitempty"`
GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"`
DiscussionCategoryName *string `json:"discussion_category_name,omitempty"`
}
Expand All @@ -196,6 +199,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str
Body: release.Body,
Draft: release.Draft,
Prerelease: release.Prerelease,
MakeLatest: release.MakeLatest,
DiscussionCategoryName: release.DiscussionCategoryName,
GenerateReleaseNotes: release.GenerateReleaseNotes,
}
Expand Down Expand Up @@ -229,6 +233,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin
Body: release.Body,
Draft: release.Draft,
Prerelease: release.Prerelease,
MakeLatest: release.MakeLatest,
DiscussionCategoryName: release.DiscussionCategoryName,
}

Expand Down
4 changes: 4 additions & 0 deletions github/repos_releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ func TestRepositoryReleaseRequest_Marshal(t *testing.T) {
Body: String("body"),
Draft: Bool(false),
Prerelease: Bool(false),
MakeLatest: String("legacy"),
DiscussionCategoryName: String("dcn"),
}

Expand All @@ -718,6 +719,7 @@ func TestRepositoryReleaseRequest_Marshal(t *testing.T) {
"body": "body",
"draft": false,
"prerelease": false,
"make_latest": "legacy",
"discussion_category_name": "dcn"
}`

Expand Down Expand Up @@ -774,6 +776,7 @@ func TestRepositoryRelease_Marshal(t *testing.T) {
Body: String("body"),
Draft: Bool(false),
Prerelease: Bool(false),
MakeLatest: String("legacy"),
DiscussionCategoryName: String("dcn"),
ID: Int64(1),
CreatedAt: &Timestamp{referenceTime},
Expand All @@ -796,6 +799,7 @@ func TestRepositoryRelease_Marshal(t *testing.T) {
"body": "body",
"draft": false,
"prerelease": false,
"make_latest": "legacy",
"discussion_category_name": "dcn",
"id": 1,
"created_at": ` + referenceTimeStr + `,
Expand Down