Skip to content

Include isImmutable in release list #11272

Description

@bdehamer

Update the list of available JSON fields in the release list command to include isImmutable flag.

This boolean flag indicates whether a particular release has been marked as immutable.

Activity

  1. andyfeller commented on Jul 11, 2025

    @andyfeller
    Contributor

    @bdehamer : Thanks for opening up this issue! ❤️ I see this relates to #11251 where the immutable field is being included in gh release view.

    Is this solely to export it via --json isImmutable`? In other words, it is not expected to be including in the list output.

    $ gh release list
    TITLE              TYPE    TAG NAME  PUBLISHED          
    GitHub CLI 2.75.0  Latest  v2.75.0   about 2 days ago
    GitHub CLI 2.74.2          v2.74.2   about 23 days ago
    GitHub CLI 2.74.1          v2.74.1   about 1 month ago
    GitHub CLI 2.74.0          v2.74.0   about 1 month ago
    GitHub CLI 2.73.0          v2.73.0   about 1 month ago
    GitHub CLI 2.72.0          v2.72.0   about 2 months ago
    GitHub CLI 2.71.2          v2.71.2   about 2 months ago
    GitHub CLI 2.71.1          v2.71.1   about 2 months ago
    GitHub CLI 2.71.0          v2.71.0   about 2 months ago
    GitHub CLI 2.70.0          v2.70.0   about 2 months ago
    GitHub CLI 2.69.0          v2.69.0   about 3 months ago
    GitHub CLI 2.68.1          v2.68.1   about 4 months ago
    GitHub CLI 2.68.0          v2.68.0   about 4 months ago
    GitHub CLI 2.67.0          v2.67.0   about 5 months ago
    GitHub CLI 2.66.1          v2.66.1   about 5 months ago
    GitHub CLI 2.66.0          v2.66.0   about 5 months ago
    GitHub CLI 2.65.0          v2.65.0   about 6 months ago
    GitHub CLI 2.64.0          v2.64.0   about 6 months ago
    GitHub CLI 2.63.2          v2.63.2   about 7 months ago
    GitHub CLI 2.63.1          v2.63.1   about 7 months ago
    GitHub CLI 2.63.0          v2.63.0   about 7 months ago
    GitHub CLI 2.62.0          v2.62.0   about 7 months ago
    GitHub CLI 2.61.0          v2.61.0   about 8 months ago
    GitHub CLI 2.60.1          v2.60.1   about 8 months ago
    GitHub CLI 2.60.0          v2.60.0   about 8 months ago
    GitHub CLI 2.59.0          v2.59.0   about 8 months ago
    GitHub CLI 2.58.0          v2.58.0   about 9 months ago
    GitHub CLI 2.57.0          v2.57.0   about 9 months ago
    GitHub CLI 2.56.0          v2.56.0   about 10 months ago
    GitHub CLI 2.55.0          v2.55.0   about 10 months ago
    
    $ gh release list --json
    Specify one or more comma-separated fields for `--json`:
      createdAt
      isDraft
      isLatest
      isPrerelease
      name
      publishedAt
      tagName
  2. bdehamer commented on Jul 11, 2025

    @bdehamer
    ContributorAuthor

    @andyfeller correct. For now, I'd just like to to be available in the json output.

    There may come a time later where it makes sense to surface it as part of the normal output, but we're not quite ready for that yet.

  3. github-actions commented on Aug 11, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had any activity in the last 30 days,
    and it will be closed in 30 days if no further activity occurs.

    If you think this is a mistake, please comment on this issue to keep it open.

  4. github-actions commented on Sep 11, 2025

    @github-actions
    Contributor

    This issue has been automatically closed due to inactivity.

    If you think this is a mistake, please comment on this issue.

  5. babakks commented on Oct 24, 2025

    @babakks
    Member

    As a refresher on this, we need to do feature detection before making GraphQL API calls. If the Release.immutable field is present on the schema we can include the field. Otherwise, we should just leave IsImmutable to false (zero value) since on unsupported host versions, releases are not immutable. This is a leaking of business/backend logic into gh, but we have already done this for release view and we're confident that this is not going to break.

    Required changes

    1. A new feature detection method to inspect the Release object type using the query below and checks if the immutable field is on the schema.

      query {
        __type(name: "Release") {
          fields {
            name      
          }
        }
      }

      The release list command now has to instantiate a feature detector and provide the support status to the fetcher (see no 2).

    2. This is where we fetch the list of releases via GQL:

      func fetchReleases(httpClient *http.Client, repo ghrepo.Interface, limit int, excludeDrafts bool, excludePreReleases bool, order string) ([]Release, error) {
      type responseData struct {
      Repository struct {
      Releases struct {
      Nodes []Release
      PageInfo struct {
      HasNextPage bool
      EndCursor string
      }
      } `graphql:"releases(first: $perPage, orderBy: {field: CREATED_AT, direction: $direction}, after: $endCursor)"`
      } `graphql:"repository(owner: $owner, name: $name)"`
      }

      And this is the Release struct:

      type Release struct {
      Name string
      TagName string
      IsDraft bool
      IsLatest bool
      IsPrerelease bool
      CreatedAt time.Time
      PublishedAt time.Time
      }

      Since the immutable field is only available on newer GH hosts, we might want to refactor the strongly-typed query back to plain string. This way we can dynamically modify the list of fields to fetch.

    Acceptance Criteria

    Given I'm using gh against github.com
    When I run gh release list -R OWNER/REPO
    Then I see no changes in the output structure

    Given I'm using gh against github.com
    When I run gh release list -R OWNER/REPO --json name,isImmutable
    Then I see the isImmutable field is correctly assigned

    Given I'm using gh against a GHES host that does not support immutable releases
    When I run gh release list -R OWNER/REPO --json name,isImmutable
    Then I see the isImmutable field is set to false for all entries

    Given I'm using gh against a GHES host that supports immutable releases
    When I run gh release list -R OWNER/REPO --json name,isImmutable
    Then I see the isImmutable field is correctly assigned

  6. joncrismuleon-bit commented on Nov 8, 2025

    @joncrismuleon-bit

    Update the list of available JSON fields in the release list command to include isImmutable flag.

    This boolean flag indicates whether a particular release has been marked as immutable.

    |

  7. joncrismuleon-bit commented on Nov 8, 2025

    @joncrismuleon-bit

    Update the list of available JSON fields in the release list command to include isImmutable flag.

    This boolean flag indicates whether a particular release has been marked as immutable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementa request to improve CLIgh-releaserelating to the gh release command

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions