Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msmygit/gh_contributors
Fetches the contributors list from a GitHub org & repo and quickly creates a pie chart based on a parameter
https://github.com/msmygit/gh_contributors
contributors github pie-chart python
Last synced: 8 days ago
JSON representation
Fetches the contributors list from a GitHub org & repo and quickly creates a pie chart based on a parameter
- Host: GitHub
- URL: https://github.com/msmygit/gh_contributors
- Owner: msmygit
- License: mit
- Created: 2024-10-02T23:52:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T17:34:09.000Z (2 months ago)
- Last Synced: 2024-10-30T10:13:56.348Z (about 2 months ago)
- Topics: contributors, github, pie-chart, python
- Language: Python
- Homepage: https://github.com/msmygit/msmygit
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# GitHub Contributors
- Fetches the contributors list from a GitHub org & repo combo and quickly creates a pie chart based on a parameter.
- Using this script simplifies pulling a repo contribution, making the process more robust and improving the user experience.
- GitHub has [default rate-limits](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28) for API calls in place and hence we use PAT tokens here. If you don't want to mess with tokens and want a more quick-and-dirty method, answers at [this stackoverflow post](https://stackoverflow.com/questions/9597410/list-all-developers-on-a-project-in-git) has it and one could do some manual steps with the data.> [!IMPORTANT]
> This utility can only access [*non-anonymous* GitHub user profile](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/setting-your-profile-to-private) data.## Getting Started
1. Preferably, create [a python virtual environment](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments) or skip this step if an environment is already available to run this.
2. Install the recommended packages:
```
sudo apt install python3-pip -y
pip3 install requests matplotlib urllib3
```
3. Get it going with `chmod +x ./gh_contributors.py && ./gh_contributors.py`
4. There will be 3 files created, in case of a happy path:
- `__contributors_.json` containing the contributor details.
- `__login_details_.json` containing the contributor/user details from above data.
- `__pie_chart_.png` containing a simple pie chart based on contributor distribution.Expand/Collapse to view the steps to run this program in a non-interactive mode
For those who prefer the non-interactive mode, set the below environment variables and run it with step 3 from above,
```
export GH_TOKEN= (or) GITHUB_TOKEN=
export GH_ORG=
export GH_REPO=
export USER_CHART_BASED_ON=
```## Things To Know
The GitHub PAT token needs to have access to an organization's repositories or else one will see an error as below in the JSON files,
```
{"message":"Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization.","documentation_url":"https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/","status":"403"}
```