Skip to content

Commit

Permalink
doc:readme
Browse files Browse the repository at this point in the history
- update readme
  • Loading branch information
ghinks committed Dec 23, 2024
1 parent 960a657 commit 297a052
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
66 changes: 44 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,54 @@
# pr-reviews

For a github organization get the pull requests reviews for all repositories
within a time range and produce a table with the reviewers and the number of
PRs reviewed by them.
This tool is intended to retrieve basic statics about the reviews of pull
requests for a GitHub organization in a given time frame. The default time
from is 2 weeks. The tool will retrieve statistics only on repositories that
have specific languages when specified.

A very linear approach is being taken
- query the org to get the repositories
- query the repositories to get the pull requests
- query the pull requests to get the reviews
- count the reviews by reviewer
- present a an ordered table of the reviewers and the number of reviews

## Usage
basic usage:
```bash
pr_reviews -o kubernetes -l python
```

which would produce the following output

```shell
python pr_reviews.py --org "my-org" --start-date "2021-01-01" --end-date "2021-12-31"
user total
--------------------- --
user1 26
user2 18
user3 15
```
This output shows the number of reviews that each user has carried out in the
time period for the repositories that have python as a language specified.

This program uses your local environment to authenticate with github using the
GITHUB_TOKEN environment variable.
The authors intent is to provide basic statistics about who is carrying out
reviews over a period of time so that the organization can better understand
who is contributing to the review process.

## Development
A comma separated list of languages can be provided to filter the repositories
that are included in the statistics. If no languages are provided then all of
the repositories will be included in the statistics.

### linting
```shell
poetry run black .
multiple languages:
```bash
pr_reviews -o kubernetes -l python,go
```
### local development
```shell
python -m pr_reviews.main --help
```

All languages:
```bash
pr_reviews -o kubernetes
```

Specifying the time frame:
```bash
pr_reviews -o kubernetes -l python -s 2021-01-01 -e 2021-01-31
```

## Options

* -o, --organization The Github organization that you want to query
* -l, --languages A comma separated list of languages that you want to include
* -s, --start-date The start date for the time frame that you want to query (optional)
* -e, --end-date The end date for the time frame that you want to query (optional)
* -h, --help Show this message and exit
2 changes: 1 addition & 1 deletion pr_reviews/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main() -> None:
# convert the dictionary to a list of lists and
# sort by the number of PRs reviewed
table = sorted(table, key=lambda x: x[1], reverse=True)
print(tabulate(table)) # noqa: T201
print(tabulate(table, ["User", "total"])) # noqa: T201


if __name__ == "__main__":
Expand Down

0 comments on commit 297a052

Please sign in to comment.