Purpose
Getting total number of downloads
for all releases
of all repositories
of a GitHub user
by username
Preparation
Assuming you have Node.JS installed
- Create a Personal Access Token (Following GitHub Docs)
No scopes (permissions) needed — just the token
Usage
As a CLI
GITHUB_TOKEN=ghp_321yourPersonalAccessToken npx @artginzburg/github-user-downloads username
if username is ommited, uses $USER environment variable instead.
As an ES module
I'm personally using it via a GitHub Action with cron
to fetch my stats daily. Also, GitHub Actions provide you a GITHUB_TOKEN, with no need to create it manually.
Testing
- Clone the repo
- Install dependencies (
npm i
) - Set
GITHUB_TOKEN
and USER
(if your local username is not the one you want to check) environmental variables (use .env
file if you want) - Run
npm test
, or npm start username