Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aont/4e4d4d7bb9bbcb091b831b5200413ed7 to your computer and use it in GitHub Desktop.

Select an option

Save aont/4e4d4d7bb9bbcb091b831b5200413ed7 to your computer and use it in GitHub Desktop.

๐Ÿ“˜ How to Retrieve GitHub Release Tags and Assets Programmatically Using the GitHub API

GitHub provides a comprehensive REST API that enables developers to programmatically access information about repositories, releases, and downloadable assets. This is especially useful for automating software distribution, checking version histories, or integrating with CI/CD pipelines.

Below is an explanation of how to retrieve release-related dataโ€”including specific release assets and all available tagsโ€”from a GitHub repository using various API endpoints.


๐Ÿ”น 1. Get the Latest Release

Endpoint:

GET https://api.github.com/repos/{owner}/{repo}/releases/latest

Example:

GET https://api.github.com/repos/frida/frida/releases/latest

Purpose: Fetches metadata about the most recently published release in a given repository.

Returns:

  • tag_name: Version tag of the release (e.g., 17.2.6)
  • html_url: Link to the GitHub release page
  • assets: List of downloadable files (each with name and browser_download_url)

Use Case: Ideal when you always want to fetch the most up-to-date version of a project without needing to know the tag in advance.


๐Ÿ”น 2. Get a Specific Release by Tag

Endpoint:

GET https://api.github.com/repos/{owner}/{repo}/releases/tags/{tag}

Example:

GET https://api.github.com/repos/frida/frida/releases/tags/17.2.6

Purpose: Retrieves release metadata and assets for a specific version, using the release's tag name.

Returns:

  • name, tag_name, body (release notes)
  • Asset list with download URLs โ†’ e.g., https://github.com/frida/frida/releases/download/17.2.6/frida-android-arm.xz

Use Case: When you need to download files or validate a specific release version.


๐Ÿ”น 3. List All Published Releases (and Their Tags)

Endpoint:

GET https://api.github.com/repos/{owner}/{repo}/releases

Example:

GET https://api.github.com/repos/frida/frida/releases

Purpose: Returns a list of all published releases, each containing a tag_name. Note: This excludes Git tags that do not correspond to published releases.

Pagination: By default, returns 30 items per page. Use ?per_page=100&page=1 for full retrieval.

Use Case: Ideal for showing a history of all published releases or generating changelogs.


๐Ÿ”น 4. List All Git Tags (Including Unreleased Tags)

Endpoint:

GET https://api.github.com/repos/{owner}/{repo}/tags

Example:

GET https://api.github.com/repos/frida/frida/tags

Purpose: Returns a list of all Git tags in the repository, whether or not they are associated with published releases.

Returns:

  • name: The tag name (e.g., 17.2.6)
  • commit: Associated commit SHA

Use Case: When you need all version tags, even those not published as formal releases.


๐Ÿ†š Summary Table

Goal Endpoint Includes Unpublished Tags? Assets Included?
Get latest release /releases/latest โŒ โœ…
Get release by tag /releases/tags/{tag} โŒ โœ…
Get all published releases /releases โŒ โœ…
Get all Git tags /tags โœ… โŒ

โœ… Example Python Snippet to List All Release Tags

import requests

url = "https://api.github.com/repos/frida/frida/releases"
response = requests.get(url)
response.raise_for_status()
for release in response.json():
    print(release["tag_name"])

These APIs offer reliable and flexible methods to access GitHub release data. Whether you're building an update checker, an automated downloader, or just collecting metadata, these endpoints will cover most use cases.

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