image_pdfimage_print

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 https://github.com/purestorage-openconnect/powershellsdk.

  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 https://github.com/settings/tokens to generate a new API token or find an existing token.

PowerShell script:

Sample output:

Download the script Get-GitHubRelDownloads.ps1 from https://github.com/PureStorage-OpenConnect/powershell-scripts. Be sure to check https://code.purestorage.com for all of our open source projects and scripts.