A command line tool that calculates pull-request and issue metrics given a GitHub repository
Create a personal GitHub token with the scopes repo.
Run the tool using npx
:
GITHUB_TOKEN=<your-token> npx @figify/gh-metrics --a <account org or user> --r <repository name>
or straight:
npx @figify/gh-metrics --a <account org or user> --r <repository name>
if you have a GITHUB_TOKEN
environment variable already set.
Example for a dependency used:
GITHUB_TOKEN=<your-token> npx @figify/gh-metrics --a sindresorhus --r ora
Set the GITHUB_URL
environment variable (i.e. https://<github-enterprise-host>/api
):
GITHUB_URL=<your-url> npx @figify/gh-metrics --a <account org or user> --r <repository name>
if you have a GITHUB_TOKEN
environment variable already set or:
GITHUB_URL=<your-url> GITHUB_TOKEN=<your-token> npx @figify/gh-metrics --a <account org or user> --r <repository name>
if not.
The following metrics are calculated:
- Average Time to Close (in days, does not account for issues closed and re-opened)
- Average Comments per Issue
- Average Time to Merge (in days)
- Average Comments per PR (Open, Closed or Merged)
- Average Comments per PR (Closed or Merged)
- Average Reviews per PR (Closed or Merged)
- Average Interactions (comments, reviews, review comments) per PR (Closed or Merged)
- Add GitHub Actions
- Add some testing
- Publish both to npm and GitHub registries
- Do the calculations in memory instead of storing in memory everything
- Store in csv/json files option
- Option to calculate only issues or only PR metrics
- Create a mini-site
TODO
Example because I forget:
git tag -a v0.1.0 -m "Version 0.1.0 - First working version"
git push origin v0.1.0
npm publish --access public --dry-run
npm publish --access public