This project provides a dashboard for monitoring key statistics about branches and pull requests (PRs) across GitHub repositories within an organization. It collects data from GitHub, stores it in a local database, and visualizes trends over time.
- Tracks the number of open branches.
- Calculates the average lifetime of branches (from creation to merge).
- Calculates the average lifetime of pull requests (from open to merge).
- Calculates the average time gap between branch creation and PR opening.
- Displays interactive plots of these statistics over time on a web-based dashboard.
The project consists of two main components:
- Data Collector: A Python script (
src/data_collector.py
) that periodically fetches data from the GitHub API and updates a SQLite database. - Dashboard: A Flask web application (
src/dashboard.py
) that reads data from the database, calculates statistics, and presents them on a dashboard using Plotly.
- Docker: Ensure you have Docker installed on your system.
- GitHub Personal Access Token: Generate a GitHub Personal Access Token with the necessary permissions to access repository data (read access to
repo
).
-
Clone the repository:
git clone https://your-repository-url.git
-
Set up environment variables:
- Copy the
.env.example
file to.env
. - Fill in the values for
GITHUB_TOKEN
(your GitHub Personal Access Token),ORG_NAME
(your GitHub organization name), andREPOSITORIES
(a comma-separated list of the repositories you want to track).
- Copy the
-
Start the application:
docker-compose up -d --build
-
Access the dashboard:
- Open your web browser and navigate to
http://localhost:8080
(or your server's IP/domain if deployed).
- Open your web browser and navigate to
- Statistics: You can modify the
StatsCalculator
class insrc/database/stats.py
to add or customize the statistics you want to track. - Dashboard: The
src/dashboard.py
file and thesrc/templates/index.html
template can be modified to change the appearance and functionality of the dashboard.
- Docker: The provided
Dockerfile
anddocker-compose.yml
files are designed to make it easy to deploy the application using Docker. - Production: For production deployment, consider using a production-grade WSGI server (e.g., Gunicorn) for the Flask app and configuring a process manager (e.g., Supervisor) to keep the containers running.
Contributions are welcome! Please feel free to open issues or submit pull requests.
This project is licensed under the MIT License.