GitHub CLI Releases, Gists, and API

Release management, gist workflows, and direct REST or GraphQL automation with gh api.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Releases
List releases
gh release list

# List releases for a repository.

View a release
gh release view v1.2.3

# Show details for a release tag.

Create a release
gh release create v1.2.3 dist/*.tgz --title "v1.2.3" --notes "Bug fixes and improvements"

# Create a release and upload assets.

Create release notes automatically
gh release create v1.2.3 --generate-notes

# Generate release notes automatically.

Upload release assets
gh release upload v1.2.3 ./dist/app-linux-amd64.tar.gz#linux-amd64

# Upload additional assets to a release.

Download release assets
gh release download v1.2.3 -D ./downloads

# Download assets for a release.

Edit a release
gh release edit v1.2.3 --title "v1.2.3 stable"

# Edit release metadata.

Delete a release asset
gh release delete-asset v1.2.3 app-linux-amd64.tar.gz --yes

# Delete a specific release asset.

Delete a release
gh release delete v1.2.3 --cleanup-tag --yes

# Delete a release and optionally its tag.

Verify artifact attestation
gh attestation verify ./dist/app-linux-amd64.tar.gz --repo my-org/my-repo

# Verify an artifact attestation against a repository.

## Gists
List gists
gh gist list

# List your gists.

View a gist
gh gist view abcd1234

# Show a gist.

Create a gist
gh gist create notes.md --public

# Create a public gist from a file.

Create a private gist from stdin
printf "hello
" | gh gist create -f hello.txt

# Create a gist from standard input.

Edit a gist description
gh gist edit abcd1234 -d "Updated shell snippets"

# Edit a gist.

Clone a gist
gh gist clone abcd1234

# Clone a gist locally.

Rename a gist file
gh gist rename abcd1234 old.txt new.txt

# Rename a file within a gist.

Delete a gist
gh gist delete abcd1234 --yes

# Delete a gist.

## API and GraphQL
Call a REST endpoint
gh api repos/{owner}/{repo}

# Call a GitHub REST API endpoint.

POST to a REST endpoint
gh api repos/{owner}/{repo}/issues -f title="Bug report" -f body="Details..."

# Create resources through the REST API.

Add custom headers
gh api repos/{owner}/{repo} -H "Accept: application/vnd.github+json"

# Call the API with explicit headers.

Send JSON from file
gh api graphql --input query.json

# Send request payload from a file.

Run a GraphQL query inline
gh api graphql -f query='query($owner:String!,$repo:String!){repository(owner:$owner,name:$repo){name defaultBranchRef{name}}}' -F owner=cli -F repo=cli

# Call the GraphQL API with variables.

Send a PATCH request
gh api repos/{owner}/{repo} --method PATCH -f description="New description"

# Update resources with a non-GET method.

Slurp paginated JSON into an array
gh api orgs/{owner}/repos --paginate --slurp

# Combine paginated results into a single JSON array.

Delete via API
gh api repos/{owner}/{repo}/issues/comments/123456 --method DELETE

# Delete a resource through the REST API.

Recommended next

No recommendations yet.