This Python script fetches data from a list of GitHub repositories and counts the number of unique contributors who submitted at least one pull request within a given date range. It also generates a text file with the URLs of the pull requests and the corresponding authors.
- Python 3.x
requests
library in Python- GitHub Personal Access Token
- Clone this repository.
- Install the required Python packages using the following command:
pip install -r requirements.txt
Before running the script, you must set the GITHUB_TOKEN
environment variable to your
GitHub Personal Access Token. You can generate a new token by going to
Settings -> Developer Settings -> Personal Access Tokens in your GitHub account.
Check the 'repo' scope while generating the token to grant necessary permissions.
To specify the repositories for which you want to count the contributors, update the repositories.txt file in the root directory of the project. Each line should contain the owner and repository name in the format owner/repo, with each repository on a separate line.
To run the script, use the following command format:
python pr_counter.py YYYY-MM-DD YYYY-MM-DD
Replace YYYY-MM-DD
with the start and end dates of the range for which you want to count contributors.
The script will print the total number of unique contributors and the name of a text file containing the URLs and authors of the pull requests.
To count the contributors from June 1, 2023, to June 28, 2023, use the following command:
python pr_counter.py 2023-06-01 2023-06-28
The script will print the total number of unique contributors and the name of a text file. This file contains the URL and author for each pull request made within the specified date range.
Each line of the file represents one pull request and is formatted as follows:
PR URL: <url> Author: <author's GitHub username>
This project is licensed under the terms of the MIT license.