The PowerShell scripts here provide a simple way to retrieve release download statistics from any public GitHub repository. This scripts can be called with the repository’s URL. It will then generate a list of releases and the number of downloads.

Also

Overview

https://api.github.com/repos/djaus2/SwissTimingGemini7SegDisplay/releases generates copious information about the djaus2/SwissTimingGemini7SegDisplay repository and its releases. (Copy the URL and paste into a web browser.)

Part of the repsonse:

    "url": "https://api.github.com/repos/djaus2/SwissTimingGemini7SegDisplay/releases/372842105",
    ...
    ...
    "assets": [
      {
        "url": "https://api.github.com/repos/djaus2/SwissTimingGemini7SegDisplay/releases/assets/520487077",
        "id": 520487077,
        "node_id": "RA_kwDOSATnb84fBgCl",
        "name": "SwissTimingDisplay-v4.6.4.zip",
        ...
         "tag_name": "v4.6.4",        
         ...
        "download_count": 1,
        ...

The scripts presented here extract just the release Id and the number of downloads for each from that data generated as per using any GitHub repository’s URL

Direct Script

Copy the script and paste into a Powershell terminal:

$repo = "djaus2/SwissTimingGemini7SegDisplay"
$url = "https://api.github.com/repos/$repo/releases"

$releases = Invoke-RestMethod `
     -Uri $url `
     -Headers @{
         "Accept" = "application/vnd.github+json"
         "User-Agent" = "PowerShell"
     }
 
$results = foreach ($release in $releases) {
     [PSCustomObject]@{
         TagName      = $release.tag_name
         DownloadCount = ($release.assets | Measure-Object -Property download_count -Sum).Sum
     }
 }

 $results | Format-Table -AutoSize

eg:

TagName DownloadCount
------- -------------
v4.6.4           1.00
v4.6.3           0.00
v4.6.2           0.00
v4.6.1           0.00

.

GitHubReleaseTools script

The script:

  • Accepts a GitHub repository URL as a parameter.
  • Extracts the repository owner and name.
  • Calls the GitHub Releases API.
  • Aggregates asset download counts by release.
  • Returns PowerShell objects suitable for filtering, sorting, exporting, and reporting.

No authentication is required for public repositories.


Setup

Save the following Powershell file in local folder. Run examples in that folder as a Powershell terminal. Change the parameter in the examples as required.

GitHubReleaseTools.ps1

function Get-GitHubReleaseDownloads {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string]$RepositoryUrl
    )

    if ($RepositoryUrl -match 'github\.com/(?<Owner>[^/]+)/(?<Repo>[^/]+)') {
        $owner = $Matches.Owner
        $repo = $Matches.Repo
    }
    else {
        throw "Invalid GitHub repository URL: $RepositoryUrl"
    }

    $apiUrl = "https://api.github.com/repos/$owner/$repo/releases"

    $headers = @{
        Accept      = "application/vnd.github+json"
        User-Agent  = "PowerShell"
    }

    $releases = Invoke-RestMethod `
        -Uri $apiUrl `
        -Headers $headers

    foreach ($release in $releases) {

        $downloadCount = (
            $release.assets |
            Measure-Object -Property download_count -Sum
        ).Sum

        [PSCustomObject]@{
            TagName       = $release.tag_name
            ReleaseName   = $release.name
            PublishedAt   = [datetime]$release.published_at
            DownloadCount = $downloadCount
        }
    }
}

Examples

Get Download Statistics

. .\GitHubReleaseDownloads.ps1; Get-GitHubReleaseDownloads -RepositoryUrl "https://github.com/djaus2/SwissTimingGemini7SegDisplay"

Display as Table

. .\GitHubReleaseDownloads.ps1; Get-GitHubReleaseDownloads -RepositoryUrl "https://github.com/djaus2/SwissTimingGemini7SegDisplay" | Format-Table -AutoSize

Sample output:

TagName ReleaseName PublishedAt            DownloadCount
------- ----------- -----------            -------------
v4.6.4  v4.6.4      19/08/2026 6:34:15 AM           1.00
v4.6.3  v4.6.3      17/08/2026 2:46:32 AM           0.00
v4.6.2  v4.6.2      17/08/2026 2:44:46 AM           0.00

Export Results

CSV

. .\GitHubReleaseDownloads.ps1; Get-GitHubReleaseDownloads -RepositoryUrl "https://github.com/djaus2/SwissTimingGemini7SegDisplay" | 
    Export-Csv ReleaseDownloads.csv -NoTypeInformation

Sample output:

"TagName","ReleaseName","PublishedAt","DownloadCount"
"v4.6.4","v4.6.4","19/08/2026 6:34:15 AM","1"
"v4.6.3","v4.6.3","17/08/2026 2:46:32 AM","0"
"v4.6.2","v4.6.2","17/08/2026 2:44:46 AM","0"

JSON

. .\GitHubReleaseDownloads.ps1; Get-GitHubReleaseDownloads -RepositoryUrl "https://github.com/djaus2/SwissTimingGemini7SegDisplay" |
    ConvertTo-Json -Depth 5

Sample output:

[
  {
    "TagName": "v4.6.4",
    "ReleaseName": "v4.6.4",
    "PublishedAt": "2026-08-19T06:34:15Z",
    "DownloadCount": 1.0
  },
  {
    "TagName": "v4.6.3",
    "ReleaseName": "v4.6.3",
    "PublishedAt": "2026-08-17T02:46:32Z",
    "DownloadCount": 0.0
  },
  ...
]

Rate Limits

This module uses anonymous GitHub API access.

Access Type Requests Per Hour
Anonymous 60
Authenticated 5000

Comments

This code was developed with some help from GitHub Copilot but did require precise specifications. It initially returned an installable module and had to be manually round back to a locally usable script.


 TopicSubtopic
<  Prev:   Swiss Timing WPF App
   
 This Category Links 
Category:Web Sites Index:Web Sites