Skip to content
Latchkey

gh release list: List Releases in a Repo

gh release list prints the releases in a repository, newest first, with draft and prerelease markers.

Discovery jobs that need the latest stable tag, or that audit which versions are published, start with gh release list.

What it does

gh release list returns releases sorted by creation date, showing the title, type (latest, draft, prerelease), tag, and publish date. --json yields the same data as fields for scripting the latest tag.

Common usage

Terminal
gh release list
gh release list --limit 5
gh release list --exclude-drafts --exclude-pre-releases
gh release list --json tagName,isLatest --jq '.[] | select(.isLatest) | .tagName'

Flags

FlagWhat it does
-L, --limit <n>Maximum number of releases to list
--exclude-draftsOmit draft releases
--exclude-pre-releasesOmit prereleases
--json <fields>Output selected fields as JSON
-q, --jq <expression>Filter JSON output with jq
-R, --repo <owner/repo>Target a specific repository

In CI

Set GH_TOKEN and permissions: { contents: read }. Draft releases are only visible to tokens with write access, so a read-only token sees fewer entries; combine --json isLatest with --jq to resolve the current stable tag reliably.

Common errors in CI

"gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable" means GH_TOKEN is unset. An empty list where you expected releases usually means they are all drafts and the token is read-only. "could not determine base repository" outside a checkout is fixed with -R owner/repo.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →