Get GitHub Download Release Metrics

Cody Hosterman, Argenis Fernandez and I have posted a lot of content to GitHub and one of the details I always wanted to know was “# of downloads for project X”. Although GitHub provides some nice traffic and cloning graphs it still does not show the number of downloads for a release. So I took to the GitHub API and PowerShell to figure it out. The below script can be run with three parameters:

  1. $gitHubRepository
  2. $gitHubUserName
  3. $gitHubApiKey

As an example I have used the Pure Storage PowerShell SDK to show sample results. The URL for the PowerShell SDK is

  1. $gitHubRepository = powershellsdk
  2. $gitHubUserName = purestorage-openconnect
    Note: Change this to your specific username to run against your own Public and Private repos.
  3. $gitHubApiKey — Log into your GitHub account and navigate to to generate a new API token or find an existing token.


PowerShell script:

$gitHubRepository = "powershellsdk"
$gitHubUsername = "purestorage-connect"

$gitHubApiKey = "<TOKEN>"

$releaseParams = @{}

$releaseParams = @{
    Uri = "$gitHubUsername/$gitHubRepository/releases";
    Method = 'GET';
    Headers = @{
        Authorization = 'Basic ' + [Convert]::ToBase64String(
            [Text.Encoding]::ASCII.GetBytes($gitHubApiKey + ":x-oauth-basic")
    ContentType = 'application/json';
    Body = (ConvertTo-Json $releaseData -Compress)
$ServicePoint = [System.Net.ServicePointManager]::FindServicePoint($($releaseParams.Uri))

$results = Invoke-RestMethod @releaseParams

$assets = $result.assets
ForEach($result in $results) {
    Write-Host "Name: $($"
    Write-Host "Release: $($result.tag_name)"
    Write-Host "Downloads: $($result.assets.download_count)"
    Write-Host "URL: $($result.assets_url)"

$ServicePoint.CloseConnectionGroup("") | Out-Null

Sample output:

Name: Pure Storage PowerShell SDK
Release: v1.5.5.0
Downloads: 0 0 11 4
Name: Pure Storage PowerShell SDK
Release: v1.5.4.0
Downloads: 0 0 6 2


Download the script from