Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/br0ken-/gh-pr-approver
Automated GitHub Pull Request approver.
https://github.com/br0ken-/gh-pr-approver
aws aws-lambda bot github github-api github-bot pull-request-approver review
Last synced: 18 days ago
JSON representation
Automated GitHub Pull Request approver.
- Host: GitHub
- URL: https://github.com/br0ken-/gh-pr-approver
- Owner: BR0kEN-
- Created: 2020-06-16T12:27:09.000Z (over 4 years ago)
- Default Branch: v2
- Last Pushed: 2022-12-24T22:01:28.000Z (about 2 years ago)
- Last Synced: 2023-03-11T13:19:10.452Z (almost 2 years ago)
- Topics: aws, aws-lambda, bot, github, github-api, github-bot, pull-request-approver, review
- Language: JavaScript
- Homepage:
- Size: 7.08 MB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automated GitHub Pull Request approver
The worker that automatically approves pull requests on GitHub from the authors you trust.
## Usage
```
$ npm run daemon -- -h
usage: gh-pr-approver [-h] [-i INTERVAL] [-a USERNAME] org queryAutomated GitHub Pull Request approver.
positional arguments:
org The name of a GitHub organization. Can be superseded by the
"GITHUB_ORGANIZATION" environment variable.
query The query to find repositories (e.g. "fluent" or "fluent OR typescript").
Can be superseded by the "GITHUB_REPOS_QUERY" environment variable.optional arguments:
-h, --help show this help message and exit
-i INTERVAL, --interval INTERVAL
The interval (in minutes) to check for requested reviews (defaults to 10,
minimum - 3, maximum - 120). Can be superseded by the "CHECK_INTERVAL"
environment variable.
-a USERNAME, --accept-author USERNAME
The GitHub usernames whose PRs should be automatically approved. Can be
superseded by the "GITHUB_ACCEPTED_AUTHORS" environment variable.
```### Example
This configuration starts a worker that checks for open PRs once in 10 minutes in the repositories of `microsoft` organization, containing the `fluent` or `typescript` in their names (see https://github.com/orgs/microsoft/repositories?q=fluent+OR+typescript+in%3Aname). You can also use logical operators like `OR` and `AND` to widen the results (e.g. `fluent OR typescript OR gsl`, https://github.com/orgs/microsoft/repositories?q=fluent+OR+typescript+OR+gsl+in%3Aname). See more at https://help.github.com/en/github/searching-for-information-on-github/searching-for-repositories.
The PR can be automatically approved when the following rules met:
- the PR is not a draft;
- the PR was created by users specified by the `--accept-author`;
- the PR requests a review from a user the access token belongs to.```shell
export GITHUB_ACCESS_TOKEN=your_token
npm run daemon -- microsoft "fluent OR typescript" --accept-author BR0kEN- --accept-author jondoe
```#### Notes
- The `GITHUB_ACCESS_TOKEN` environment variable is mandatory and must contain a valid GitHub access token that can be used for accessing a range of repositories.
- The worker will approve a PR again in case the previous review has been dismissed and the new one requested.
- Add as many `--accept-author` as you need.
- It is possible to replace `npm run daemon` arguments with the environment variables. Example:
```shell
export GITHUB_ACCESS_TOKEN=your_token
export GITHUB_ORGANIZATION=microsoft
export GITHUB_REPOS_QUERY="fluent OR typescript"
# The `+` character is a separator
# allowing to provide multiple users.
export GITHUB_ACCEPTED_AUTHORS="BR0kEN-+jondoe"
export CHECK_INTERVAL=5
npm run daemon
```## Deploy
- [AWS](deploy/aws)