For questions, check out the GitHub discussions.
For documentation, check out this document and the official documentation.
Join our Community on Discord!
To start using Reviewpad, check out our website.
Reviewpad is service to automate pull request and issues workflows.
The workflows are specified in a YML-based configuration language described in the official documentation.
In Reviewpad, you can automate actions over the pull requests and issues such as:
- Automated comments;
- Add or remove labels;
- Specify reviewer assignments;
- Automate close/merge actions;
- Block the merge action;
- Automatically summarize pull requests;
As an example, the following workflow:
labels:
ship:
description: Ship mode
color: "#76dbbe"
workflows:
- name: ship
description: Ship process - bypass the review and merge with rebase
if:
- $hasFileExtensions([".md"])
then:
- $addLabel("ship")
- $merge()
Automatically adds the label ship
and merges all pull requests that only change .md
files.
You can execute Reviewpad through the CLI or install Reviewpad GitHub App.
This repository generates two artifacts:
- CLI cli that runs reviewpad open source edition.
- Reviewpad library packages:
- github.com/reviewpad/reviewpad/collector
- github.com/reviewpad/reviewpad/engine
- github.com/reviewpad/reviewpad/lang/aladino
- github.com/reviewpad/reviewpad/plugins/aladino
- github.com/reviewpad/reviewpad/utils
Conceptually, the packages are divided into four categories:
- Engine: The engine is the package responsible of processing the YML file. This process is divided into two stages:
- Process the YML file to determine which workflows are enabled. The outcome of this phase is a program with the actions that will be executed over the pull request.
- Execution of the synthesised program.
- Aladino Language: This is the language that is used in the
spec
property of the rules and also the actions of the workflows. The engine of Reviewpad is not specific to Aladino - this means that it is possible to add the support for a new language such asJavascript
orGolang
in these specifications. - Plugins: The plugin package contains the built-in functions and actions that act as an abstraction to the 3rd party services such as GitHub, Jira, etc. This package is specific to each supported specification language. In the case of
plugins/aladino
, it contains the implementations of the built-ins. - Utilities: packages such as the collector and the fmtio that provide utilities that are used in multiple places.
Before you begin, ensure you have met the following requirements:
- Go with the minimum version of 1.16.
- goyacc used to generate Reviewpad Aladino parser (
go install golang.org/x/tools/cmd/goyacc@master
). - libgit2 with version v1.2.
- To run the tests, Reviewpad requires the following environment variables:
INPUT_SEMANTIC_SERVICE
. You can do this by running the following command in your terminal:export INPUT_SEMANTIC_SERVICE="0.0.0.0:3006"
.INPUT_ROBIN_SERVICE
. You can do this by running the following command in your terminal:export INPUT_ROBIN_SERVICE="0.0.0.0:3011"
.INPUT_CODEHOST_SERVICE
. You can do this by running the following command in your terminal:export INPUT_CODEHOST_SERVICE="0.0.0.0:3004"
.
We use Taskfile. To compile the packages simply run:
task build
To generate the CLI run:
task build-cli
This command generate the binary reviewpad-cli
which you can run to try Reviewpad directly.
The CLI has the following argument list:
./reviewpad-cli
reviewpad-cli is command line interface to run reviewpad commands.
Usage:
reviewpad-cli [command]
Available Commands:
check Check if input reviewpad file is valid
completion Generate the autocompletion script for the specified shell
help Help about any command
run Runs reviewpad
Flags:
-f, --file string input reviewpad file
-h, --help help for reviewpad-cli
Use "reviewpad-cli [command] --help" for more information about a command.
Run the tests with:
task test
If you get the error:
panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: socket: too many open files [recovered]
panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: socket: too many open files
You can solve with:
ulimit -Sn 500
To generate the coverage report run:
task test
To display the code coverage for every package run:
go tool cover -func coverage.out
To display the total code coverage percentage run:
go tool cover -func coverage.out | grep total:
The integration tests run reviewpad on an actual repository and pull request. The repository that the integration tests are running on needs to have the following:
- At least one milestone;
- At least 3 labels named
bug
,documentation
,wontfix
(GitHub adds these labels to every new repository by default); - A team called
integration-test
with at least 3 members; - A project called
[INTEGRATION TESTS] Reviewpad
withTodo
andIn Progress
status - A GitHub status check called
log event
.
GITHUB_INTEGRATION_TEST_TOKEN
: GitHub access token used to setup tests and run reviewpadGITHUB_INTEGRATION_TEST_REPO_OWNER
: The owner of the repository used to run integration tests onGITHUB_INTEGRATION_TEST_REPO_NAME
: The name of the repository used to run integration tests on
After setting those variables, you can run the integration tests with:
task integration-test
We strongly recommend using VSCode with the following extensions:
- Go for Go language support.
- EditorConfig to helps maintaining consistent coding styles.
- licenser for adding license headers.
- YAML for enabling
reviewpad.yml
JSON schema. - JSON Parse & Stringify for formatting JSON files.
Open the project in VSCode, open the command palette (Ctrl+Shift+P) and search for Preferences: Open Workspace Settings (JSON)
.
Paste the following configuration:
{
// Licenser configuration
"licenser.license": "Custom",
"licenser.author": "Explore.dev, Unipessoal Lda",
"licenser.customHeader": "Copyright (C) @YEAR@ @AUTHOR@ - All Rights Reserved\nUse of this source code is governed by a license that can be\nfound in the LICENSE file.",
// Associate Reviewpad schema to reviewpad.(yml|yaml) files
"yaml.schemas": {
"https://raw.githubusercontent.com/reviewpad/schemas/main/latest/schema.json": [
"reviewpad.yml",
"reviewpad.yaml",
]
},
// Go configuration
"go.testFlags": [
"integration"
],
"go.buildFlags": [
"-tags=integration"
],
}
Add the following to your .vscode/launch.json
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch CLI",
"type": "go",
"request": "launch",
"mode": "debug",
"args": [
"run",
// Flag to run on dry run (optional)
"-d",
// Flag to run on safe mode (optional)
"-s",
// Absolute path to reviewpad.yml file to run
"-f=<PATH_TO_REVIEWPAD_FILE>",
// GitHub url to run the reviewpad.yml against to
"-u=<GITHUB_URL>",
// GiHub personal access token
// https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
"-t=<GIT_HUB_TOKEN>",
// Absolute path to JSON file with GitHub event
"-e=<PATH_TO_EVENT_JSON>"
],
"program": "${workspaceFolder}/cli/main.go"
}
]
}
For the argument -e
you case use either a GitHub event from a Reviewpad GitHub Action run or a GitHub event from a Reviewpad GitHub App run.
- Navigate to the logs of the Reviewpad GitHub App run where you wish to copy the event from. You can use the following query to filter the events payload
{$.level=debug && $.msg="request received" }
. - Copy the content inside the property
body
. - Paste the content inside a file (e.g.
my_event.json
) and save it undercli > debugdata
. - This content is an escape JSON string. Use the JSON Parse & Stringify extension to parse the content by pressing
Ctrl+Shift+P
and searching forJSON: Parse Stringified JSON
. - Rename the root properties
type
andpayload
toevent_name
andevent
respectively. - Update the argument
-e
to point to the full path of the file you just created.
You can then run the debugger by pressing F5.
We welcome contributions to Reviewpad from the community!
See the Contributing Guide.
If you need any assistance, please join discord to reach the core contributors.
Reviewpad is available under the GNU Lesser General Public License v3.0 license.
See LICENSE for the full license text.