An open API service indexing awesome lists of open source software.

https://github.com/diegolnasc/gotcha

A :robot: to improve pull request quality.
https://github.com/diegolnasc/gotcha

github-app golang pull-requests quality review

Last synced: 28 days ago
JSON representation

A :robot: to improve pull request quality.

Awesome Lists containing this project

README

        

Gotcha Bot :robot:


A app to automate engineers tasks

[![go-doc](https://godoc.org/github.com/diegolnasc/gotcha?status.svg)](https://godoc.org/github.com/diegolnasc/gotcha)
[![go-report](https://goreportcard.com/badge/github.com/diegolnasc/gotcha)](https://goreportcard.com/report/github.com/diegolnasc/gotcha)
![license](https://img.shields.io/github/license/diegolnasc/gotcha?style=plastic)
[![gotcha-release(latest)](https://img.shields.io/github/v/release/diegolnasc/gotcha?sort=semver&style=plastic)](https://github.com/diegolnasc/gotcha/releases)

---
## What can :robot: do?

> *Gotcha*, is a app and works on fired events. For more details on a GitHub app, please check [here](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps).

The main _Gotcha's_ features are:

- Ensure the **pull request** report (diff).
- Ensure the **pull request** name pattern is valid.
- Ensure the **pull request** labels are valid.
- Ensure the **pull request** assigners are valid.
- Ensure the **pull request** reviewers are valid.

*Gotcha* implements the some of the features as a test suite. Therefore, adding a new functionality for validation is very simple and practical.

## Examples :eye_speech_bubble:

- **Pull Request Report**

![pr-overview](docs/imgs/pr-overview.png)

- **Pull Request Test Validator**

Fail

![pr-name-pattern-fail](docs/imgs/pr-name-pattern-fail.png)

---

Pass

![pr-name-pattern-pass](docs/imgs/pr-name-pattern-pass.png)

## How to install

### GitHub app
First, go to your profile *Settings* → *Developer Settings*. Then create a GitHub app for *Gotcha* :smiley:.

Fill in the necessary information to create the app.
![install-1](docs/imgs/install-1.png)
![install-2](docs/imgs/install-2.png)

> To test without hosting or exposing your application on the internet, a suggestion is to use https://smee.io

Next, enable the following permissions:

- Repository → Checks
- Repository → Issues
- Repository → Pull requests
- Repository → Contents
- Events → Check run
- Events → Issue comment
- Events → Issues
- Events → Pull request
- Events → Pull request review comment
- Events → Pull request review

> It's worth noting that the permissions listed are *Gotcha's* default ones. If you are not interested in using some functionality or have another need, customize the permissions.

Finally, save the settings and "install" it in your profile.
Afterwards, generate a private key for the bot.

### Gotcha Settings

In the *build* folder, you will find a file called **config.yaml** which is intended to configure some _Gotcha's_ features.

- In **Layout**, you'll find general *Gotcha* settings.
- In **GitHub**, you'll find general GitHub settings.

**Layout**:

| Level | Description | Type | Default |
|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|----------------------------------------------------------------------------------------------------------------|
| administration → permission | Users who are allowed to execute commands such as pull request approval, test re-runs and others.
The permissions here are one level above the *repositories* item, so they overlap the others. | list(string) | None |
| administration → permission → repositories | Users with permissions on certain repositories. | list(object) | None |
| pullRequest → enableOverview | Enable pull request report (commits, diff, additions, deletes, extensions) overview. | bool | true |
| pullRequest → overViewCommand | Command to re-run the pull request overview. The _enableOverview_ must be true. | string | run overview |
| pullRequest → approveCommand | Command for approval of the PR by *Gotcha*. | string | lgtm |
| pullRequest → runTestSuiteCommand | Command to re-run the test suite. | string | run testsuite |
| pullRequest → mergeCommand | Command for merge of the PR by *Gotcha*. | string | merge |
| pullRequest → mergeAndDeleteCommand | Command for merge and delete ref branch of the PR by *Gotcha*. | string | merge and delete |
| pullRequest → testSuite → namePattern | Format (regex) that pull request name must follow.
Default value is based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). | string(regex) | (?Pfeat|fix|refactor|style|docs|build|chore)(?P:) (?P.+)' |
| pullRequest → testSuite → reviewers | Need to have reviewers on the pull request. | bool | false |
| pullRequest → testSuite → assignees | Need to have assignees on the pull request. | bool | true |
| pullRequest → testSuite → labels | Need to have labels on the pull request. | bool | true |

**Github**:

| Level | Description | Type | Default |
|--------------------|-----------------------------------------------------------|--------------|------------------------------------------------------------------------------------------------------|
| appId | GitHub App Id. | int | None(required) |
| organization | Name of the organization that *Gotcha* will be installed. | string | None |
| user | Name of the user that *Gotcha* will be installed. | string | None |
| webhookSecret | Webhook secret. | string | None(required) |
| privateKeyLocation | Private key location. | string | None |
| privateKey | Private key value. | string | None |
| events | List of events that *Gotcha* will listen to. | list(string) | issue
pull_request
pull_request_review_comment
pull_request_review
check_run |

## Contributing
Gotcha is an open source bot made to facilitate developers' daily lives. Thus, all features are open to be modified and/or added.

Please feel free to help!

For more details, see our guide.