Skip to content

Support for explicitly setting the latest release #2593

Closed

Description

@chrisgrautealium

GitHub recently changed the way the latest version can be managed, to allow explicitly setting the latest release. Previously, the latest release would be the most recently created non-pre-release.

https://github.blog/changelog/2022-10-21-explicitly-set-the-latest-release/

In the web UI, this shows up as two checkboxes. In the API, this is set using the make_latest parameter, which defaults to true for newly created releases.

https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#update-a-release

It does not seem that this parameter is available in the RepositoryRelease struct yet.

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"`
DiscussionCategoryName *string `json:"discussion_category_name,omitempty"`

My sample workflow is to attempt to promote an existing pre-release to the latest release. For example, given a set of releases for a repository:

TITLE      TYPE         TAG NAME   PUBLISHED
Release-4  Pre-release  Release-4  about 16 minutes ago
Release-3  Pre-release  Release-3  about 17 minutes ago
Release-2  Latest       Release-2  about 17 minutes ago
Release-1               Release-1  about 17 minutes ago

Removing the pre-release flag from Release-4:

githubClient.Repositories.EditRelease(context.Background(),
	owner, repo, *release.ID,
	&github.RepositoryRelease{Prerelease: github.Bool(false)})

This results in,

TITLE      TYPE         TAG NAME   PUBLISHED
Release-4               Release-4  about 19 minutes ago
Release-3  Pre-release  Release-3  about 19 minutes ago
Release-2  Latest       Release-2  about 19 minutes ago
Release-1               Release-1  about 19 minutes ago

It would be useful if this were possible:

githubClient.Repositories.EditRelease(context.Background(),
    owner, repo, *release.ID,
    &github.RepositoryRelease{
        Prerelease: github.Bool(false),
        Makelatest: "true", // string, because parameter supports "true", "false", "legacy"
    })

Activity

  1. gmlewis commented on Dec 7, 2022

    @gmlewis
    Collaborator

    I agree, except I would change your last example to:

    githubClient.Repositories.EditRelease(context.Background(),
        owner, repo, *release.ID,
        &github.RepositoryRelease{
            Prerelease: github.Bool(false),
            MakeLatest: github.String("true"), // string, because parameter supports "true", "false", "legacy"
        })
    

    Would you like to create a PR to support this issue, @chrisgrautealium ?
    Or would you like me to open up this issue to any other contributor to this repo?

  2. chrisgrautealium commented on Dec 7, 2022

    @chrisgrautealium
    ContributorAuthor

    Thanks for the feedback @gmlewis. I'm taking a stab at preparing a PR to support this.

  3. added a commit that references this issue on Dec 8, 2022
    44d91eb
  4. added a commit that references this issue on Jun 28, 2026
    1dd2a68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions