dluc / github-stats

Generate stats about your Github repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A set of scripts to quickly and periodically generate a web page with statistics about your GitHub repository pull requests.

  • PR summary
  • PRs open more than 5 days, last 4 months
  • Avg time to close a PR, last 4 months
  • Avg time a PR stays open, last 4 months
  • PRs open and closed, last 4 months
  • % PR closed in <5 days | <10 days | <15 days, last 4 months
  • Internal and External PRs %, last 4 months
  • External PRs open for more than 10 days
  • Internal PRs open for more than 10 days
  • PRs without assignees

image image image image image

Setup

  1. Install GitHub CLI (gh)
  2. Copy .env.example to .env and set your GitHub token and Gist URL
  3. Copy config.py.example to config.py and set the list of TEAM_MEMBERS
  4. Setup your target repo: git clone https://github.com/<YOUR REPO>.git repo
  5. Setup run.sh in your crontab, to run every 20 mins (or less frequently)

Test run

Run run.sh

How does it work?

The scripts download GitHub Pull Requests stats using GitHub CLI, saving the information locally in two files (prs.json and prs.csv). The data in these files is used to generate a few stats about your repo pull requests, writing the results to a GitHub gist markdown file.

The page contains some graphs built with quickchart.io. You can see the rendered stats creating a web page like this:

<html>

<body>
    <div style="width:1100px;margin:20px auto;">
        <script src="https://gist.github.com/<...user...>/<...gist id...>.js"></script>
    </div>
</body>

</html>

Troubleshooting

  • Use a Linux shell, e.g. Ubuntu bash or WSL
  • Install Python 3.8.10+
  • Make sure gh is visible to your crontab user.
  • Scripts work with main branch, change config.py otherwise.
  • The GitHub token needs write access to update a gist.

About

Generate stats about your Github repository

License:MIT License


Languages

Language:Python 93.1%Language:Shell 6.9%