Cron Statistics, Persistent, Update Report for Open Source Software(OSS), All in Git.
Below are the statistics charts for the Open Source Software project KusionStack/karpor 👇
This chart shows the number of external issues reported over time.
This chart illustrates the trend of external pull requests submitted.
The chart depicts the count of unique external contributors participating in the project.
This graph represents the overall number of external participants engaging with the project.
Run the script to get the current moment's open-source project metrics:
python stats-github-project.py
Use the --before
parameter to specify the filter time in ISO 8601 format:
python stats-github-project.py --before "2024-08-20T15:56:40+08:00"
Use the --only_json
parameter to output only JSON format results:
python stats-github-project.py --only_json
Use the --fix-data
parameter to fix existing metrics data in the 'data' directory:
python stats-github-project.py --fix-data
This script fetches and analyzes GitHub project metrics, including contributors, issues, and pull requests. It distinguishes between internal and external contributors based on a predefined list of internal members.
-
Environment Setup:
- Ensure you have Python installed.
- Install required packages:
pip install requests python-dotenv
. - Create a
.env
file with your GitHub token and repository details.
-
Fetching Data:
- The script uses GitHub API to fetch contributors, issues, and pull requests.
- It handles pagination to ensure all data is retrieved.
-
Filtering Data:
- If the
--before
parameter is provided, the script filters issues and pull requests created before the specified time. - If the
--fix-data
parameter is provided, the script iterates through all JSON files in thedata
directory, extracts the timestamp from the filename, and updates the file with the latest metrics.
- If the
-
Output:
- The script outputs the results in JSON format by default.
- If the
--only_json
parameter is provided, it outputs only the JSON format.
-
Initial Run:
python stats-github-project.py
-
Filter by Time:
python stats-github-project.py --before "2024-08-20T15:56:40+08:00"
-
Fix Data:
python stats-github-project.py --fix-data
- Ensure your GitHub token has the necessary permissions to access the repository.
- The script assumes the
data
directory exists and contains JSON files named in the formatstats-YYYY-MM-DDTHH:MM:SS+0800.json
.