Skip to content

diegolnasc/gotcha

Repository files navigation

Gotcha Bot 🤖

A app to automate engineers tasks

go-doc go-report license gotcha-release(latest)


What can 🤖 do?

Gotcha, is a app and works on fired events. For more details on a GitHub app, please check here.

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 👁️‍🗨️

  • Pull Request Report

pr-overview

  • Pull Request Test Validator

Fail

pr-name-pattern-fail


Pass

pr-name-pattern-pass

How to install

GitHub app

First, go to your profile SettingsDeveloper Settings. Then create a GitHub app for Gotcha 😃.

Fill in the necessary information to create the app.
install-1 install-2

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.
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.