Repository navigation
Include isImmutable in release list #11272
Description
Activity
- addedgh-releaserelating to the gh release commandrelating to the gh release command
on Jul 11, 2025 @bdehamer : Thanks for opening up this issue! ❤️ I see this relates to #11251 where the
immutablefield is being included ingh 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
- addedenhancementa request to improve CLIa request to improve CLImore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Jul 11, 2025 @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.
github-actions commented
on Aug 11, 2025 on Aug 11, 2025 – with GitHub ActionsContributorMore actionsThis 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.
github-actions commented
on Sep 11, 2025 on Sep 11, 2025 – with GitHub ActionsContributorMore actionsThis issue has been automatically closed due to inactivity.
If you think this is a mistake, please comment on this issue.
- removedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Sep 11, 2025 As a refresher on this, we need to do feature detection before making GraphQL API calls. If the
Release.immutablefield is present on the schema we can include the field. Otherwise, we should just leaveIsImmutabletofalse(zero value) since on unsupported host versions, releases are not immutable. This is a leaking of business/backend logic intogh, but we have already done this forrelease viewand we're confident that this is not going to break.Required changes
-
A new feature detection method to inspect the
Releaseobject type using the query below and checks if theimmutablefield is on the schema.query { __type(name: "Release") { fields { name } } }
The
release listcommand now has to instantiate a feature detector and provide the support status to the fetcher (see no 2). -
This is where we fetch the list of releases via GQL:
cli/pkg/cmd/release/list/http.go
Lines 38 to 49 in 85b73e4
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
Releasestruct:
cli/pkg/cmd/release/list/http.go
Lines 24 to 32 in 85b73e4
type Release struct { Name string TagName string IsDraft bool IsLatest bool IsPrerelease bool CreatedAt time.Time PublishedAt time.Time } Since the
immutablefield 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
ghagainstgithub.com
When I rungh release list -R OWNER/REPO
Then I see no changes in the output structureGiven I'm using
ghagainstgithub.com
When I rungh release list -R OWNER/REPO --json name,isImmutable
Then I see theisImmutablefield is correctly assignedGiven I'm using
ghagainst a GHES host that does not support immutable releases
When I rungh release list -R OWNER/REPO --json name,isImmutable
Then I see theisImmutablefield is set tofalsefor all entriesGiven I'm using
ghagainst a GHES host that supports immutable releases
When I rungh release list -R OWNER/REPO --json name,isImmutable
Then I see theisImmutablefield is correctly assigned-
- linked a pull request that will close this issueAdd `isImmutable` to `release list` JSON output #12064
on Oct 31, 2025 Update the list of available JSON fields in the
release listcommand to includeisImmutableflag.This boolean flag indicates whether a particular release has been marked as immutable.
|
Update the list of available JSON fields in the
release listcommand to includeisImmutableflag.This boolean flag indicates whether a particular release has been marked as immutable.
Update the list of available JSON fields in the
release listcommand to includeisImmutableflag.This boolean flag indicates whether a particular release has been marked as immutable.