Connect your code
Connecting your code links a repository to a database in DBGorilla. DBGorilla calls a database a component, and you link repositories one component at a time.
A linked GitHub repository supports two operations: pull request reviews that check the component’s live database, and Generate a PR, which turns a recommendation into a pull request. A linked GitLab project supports merge request reviews.
Turn it on
Section titled “Turn it on”For a GitHub repository, there are three steps:
- Install the DBGorilla GitHub App on your GitHub account or organization.
- Connect that installation to your DBGorilla workspace from Admin › Integrations.
- Open the component, go to its Settings tab, and add the repository under GitHub Repositories.
GitHub pull request reviews walks through each step.
For GitLab, a bot user and its tokens take the place of the App. GitLab merge request reviews covers connecting a group, choosing projects, and linking each project under GitLab Projects on the component’s Settings tab.
What the connection is used for
Section titled “What the connection is used for”Pull request reviews
Section titled “Pull request reviews”Once the App or GitLab group is connected, reviews use the pull request diff. Linking the repository to a component adds that component’s schema, query traffic and query plans to each review. Pull request reviews shows what a review contains.
Generate a PR
Section titled “Generate a PR”Generate a PR on a recommendation pushes the change to a branch in the
linked GitHub repository and opens a pull request as dbgorilla[bot]. You
review and merge it.
The button requires a GitHub repository linked to the component. Until one is linked, the button remains greyed out with the tooltip “Connect a GitHub repository to this component first.”
To generate pull requests for a component, link only GitHub repositories to it, all from the same GitHub App installation.
Generate a PR covers using it.
What the GitHub App can access
Section titled “What the GitHub App can access”The App asks GitHub for these permissions on the repositories where it is installed:
- Contents: write. Generate a PR uses this permission to push its branch and commit.
- Pull requests and Issues: write. Reviews use these permissions to post and update comments, and Generate a PR uses the pull requests permission to open its pull request.
- Commit statuses: write. Reviews use this permission to publish the DBGorilla Review status.
- Metadata: read.
The App receives one webhook event, pull_request.
When you install it, GitHub lets you choose all repositories in the account or only selected repositories. DBGorilla can link only repositories covered by that installation.
To stop using the connection, Turn it off explains what uninstalling the App, disconnecting the installation and removing a repository each do.
Related
Section titled “Related”- GitHub pull request reviews: every step of the GitHub setup.
- GitLab merge request reviews: the GitLab setup and its tokens.
- Generate a PR: turning a recommendation into a pull request.
- Security FAQ: security questions about DBGorilla, including pull requests.