https://github.com/pgimalac/github-utils
Using the Github API to get information
https://github.com/pgimalac/github-utils
Last synced: about 1 year ago
JSON representation
Using the Github API to get information
- Host: GitHub
- URL: https://github.com/pgimalac/github-utils
- Owner: pgimalac
- License: mit
- Created: 2024-01-08T00:07:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T12:24:28.000Z (over 1 year ago)
- Last Synced: 2025-02-13T01:56:07.622Z (over 1 year ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Github Utils
### How to use
This is a python script, so just run
```shell
python gh-utils.py
```
### Requirements
The required python dependencies are indicated in the `requirements.txt` file, they can be installed with:
```shell
pip install -r requirements.txt
```
### Token
This script requires a Github token to query the API.
It expects to find one in the `GITHUB_TOKEN` environment variable.
The exact permissions needed on the token depends on what function you want to query,
but overall it's read-only permissions on the repository content, pull request, and organization teams.
### Commands
#### Pull Request
##### Team Files
List files edited in a PR which are owned by a given team.
```shell
python gh-utils.py pr --url team-files --team
```
There is a `--link` or `-l` flag which prints links to those files instead of just their path.
##### Reviewers
List teams that own unreviewed files.
Note that this is not the same thing as still being requested for review, in case another team owns
the same files as you and has already reviewed.
```shell
python gh-utils.py pr --url reviewers
```
There is a `--minimal` or `-m` flag which instead only prints the minimal set of teams needed to review.
This is minimal in terms of number of teams.
This is convenient if you only need one review per owner, and codeowners are interlapping.