Docs Review code

Connect GitHub or GitLab

Install the GitHub App or connect GitLab so Entropix sees merge requests and can post its status.

Before Entropix can review a merge request, it needs to hear about it and be allowed to post on it. You give it that by connecting your Git host: install the Entropix GitHub App, or connect a GitLab group with an access token. Entropix then gets a webhook for each change, reads the change, and posts comments and one commit status. It never pushes to your repository.

In the portal Settings › Integrations Admin

Before you start

  • You need the Admin role. Every page under Settings › Integrations is for admins only.
  • For GitHub, you need to be able to install a GitHub App on the account or organisation that owns the repositories.
  • For GitLab, you need a group on GitLab.com and the right to add a Maintainer to it, or to create a group access token.
  • If GitHub or GitLab is not offered yet on your portal, the card says so: "GitHub isn't connected on this portal yet" or "Not available on this portal yet". The people who run your portal turn each host on. On your own server, see Configuration.

Connect GitHub

  1. Open Settings › Integrations and choose Connect GitHub on the GitHub card.
  2. GitHub opens the Entropix App's install page. Pick the account or organisation, choose all repositories or only some, and install.
  3. GitHub may ask you to authorize the App. Entropix uses this once, to confirm that the installation is one your own GitHub account can reach.
  4. GitHub sends you back to Settings › Integrations. A new section, GitHub · (account), shows the installation, who connected it and when.

You have 10 minutes from pressing Connect GitHub to finish on GitHub. After that, start again. Entropix keeps no GitHub token. Each review gets a short-lived token from the App. The App posts as its bot user, for example entropix[bot].

What the GitHub App may do

GitHub shows these permissions when you install the App:

PermissionAccessUsed for
Pull requestsRead and writeReading the pull request and posting review comments
ContentsRead-onlyReading the diff and the files under review
Commit statusesRead and writeSetting entropix/review on the reviewed commit
ChecksRead-onlyReading your CI checks, which decide whether a behaviour is proven
AdministrationRead-onlyThe Compliance agent: branch protection, rules, outside collaborators and deploy keys
Members (organisation)Read-onlyThe Compliance agent: members without two-factor sign-in
ActionsRead-onlyThe Compliance agent: environments and workflows
MetadataRead-onlyRequired by GitHub for every App

The App listens to three events: Pull request, Issue comment and Pull request review comment.

The Administration, Members and Actions permissions are read only and used only by the Compliance agent. An App made before they were added does not have them: whoever runs your portal adds them to the App, and GitHub then asks your installation's owner to accept. Until then, the Compliance agent reports those reads as "not reachable" with the permission to grant.

Careful

When the App gains a new permission, GitHub asks the installation's owner to accept it under GitHub's Settings › Applications › Installed GitHub Apps › Configure. Until they accept, posts that need it are refused with a 403. The review page shows each failed post with its reason and a Retry button. Press it after the permission is accepted.

Connect GitLab

Entropix connects one GitLab group at a time, with an access token. First choose your group's plan on GitLab. It decides which token you make and where the webhooks go.

PlanToken to makeWebhooks
Free (or not sure)A personal access token of a bot user who is a Maintainer of the groupOne per project, added when you watch a repository
Premium or UltimateA group access token with the Maintainer roleOne for the whole group

On Free

  1. Create a GitLab user for Entropix, for example entropix-bot. The bot user counts as one of your group's seats (GitLab Free allows 5 in a private group).
  2. Add it to the group as Maintainer.
  3. Signed in as that user, create a personal access token with the api scope.

On Premium or Ultimate

  1. In the group on GitLab, open Settings › Access tokens and choose Add new token.
  2. Pick the Maintainer role and the api scope, and set an expiry date.

Connect the token

  1. On Settings › Integrations, open Connect with an access token and pick your plan under Which GitLab plan is your group on?
  2. Paste the token into Access token. It starts with glpat-.
  3. Press Check this token. Entropix asks GitLab about it and shows the group, the handle it Posts as, what the token May do, and when it expires. Nothing is saved yet.
  4. Paste the token again and press Connect this group. Or skip the preview with Connect without the preview. Entropix still checks the token with GitLab before it stores anything.

A new section, GitLab · (group), shows the connection. Entropix uses the token to read changes and their diffs, post review comments and commit statuses, and add its webhooks. It never pushes. The token is stored encrypted and never shown back to you.

A token that does not say what it may do gets a warning: if the reviewer later cannot comment, the token needs the api scope. A token that expires within 30 days gets a warning too. You can connect it, but plan to replace it.

If the webhook could not be added

Entropix adds its own webhooks, with their secret. If GitLab refuses, the installation or the repository's row says "Couldn't add the webhook". Add it by hand:

  1. Under Connection details, open Webhook URL and copy the address.
  2. Press Show a new secret token and copy the secret. It is shown once, and the old secret stops working.
  3. On GitLab, open the project's (or group's) Settings › Webhooks. Paste the URL and the secret token, tick Merge request events and Comments, and save.

Check the connection

Each installation's section starts with one status line:

StatusMeaning
Reviews on · N watchedEverything is in place.
Connected · nothing watched yetWatch a repository to start (see Watch a repository).
Not reviewing — (reason) · N watchedThe reason is one of: setup unfinished, its group access token has expired, no reviewer chosen, or no model configured.
DisconnectedThe installation was disconnected.

The top of the page tells you the next step for reviews, for example Connect a model or Watch a repository below. It says "Reviews are on" once nothing is missing. For GitLab, Connection details lists the group, the bot handle, what the token may do, its expiry, and where the webhooks are.

Activity

Activity lists the newest 20 deliveries from your Git host: when each arrived, what it was (a change, a comment, a webhook check, an installation) and what the portal did with it. Deliveries the portal ignores, such as its own comments or events on repositories nobody watches, are folded under "N ignored". Refused before sign-in counts deliveries refused before any organisation was known, by reason: "signature did not verify", "no installation for this delivery" or "could not be read". This count covers all organisations since the portal last restarted, and nothing about those deliveries is stored.

Replies in threads lists the questions people asked the reviewer in merge request threads, and what it said (see Run a review again from the Git host).

Reconnect or replace a token

  • GitHub: to add another account or organisation, press Connect another account. To change which repositories the App sees, change the installation on GitHub, then press Refresh on the installation's repository list.
  • GitLab: to rotate a token, open Replace token and paste the new one into New access token. It must be for the same group, and it is checked before it replaces the old one. To connect another group, use Connect another group.

Disconnect

Press Disconnect at the bottom of the installation's section. New deliveries from it are refused. Events already received are still reviewed and posted. On GitLab, disconnecting does not revoke the token: revoke it on GitLab under Settings › Access tokens. On GitHub, uninstall the App on GitHub as well if you want GitHub to stop sending events.

The public endpoints

Your Git host calls Entropix at these addresses. They must be reachable from the internet. Each one checks the delivery before reading anything else in it. A body over 4 MB is refused with 413. A delivery that fails its check gets a bare 401, and an accepted one gets 202. See Webhooks and public endpoints for all of the portal's public addresses.

AddressCalled byHow it is checked
POST /hooks/githubThe Entropix GitHub App, for every organisation on the portalThe X-Hub-Signature-256 signature, checked with the App's one webhook secret. The organisation is then found from the installation named in the signed body, never from the address.
POST /hooks/gitlab/{hookID}Your GitLab group or project webhooksThe X-Gitlab-Token secret, compared with the secret of the installation the hook id belongs to. Each GitLab installation has its own random hook id and secret. An unknown hook id and a wrong secret get the same 401.
POST /hooks/{publicID}NothingThis address is not served. GitLab uses /hooks/gitlab/{hookID} and GitHub uses /hooks/github.

What you can and can't do

You can
  • Connect several GitHub accounts and several GitLab groups to one organisation.
  • Check a GitLab token before you store it.
  • Replace a GitLab token, or make a new webhook secret, without disconnecting.
  • See each delivery and what the portal did with it.
You can't
  • Connect as a Member or Viewer: Integrations is for admins.
  • Give Entropix push access. It reads, comments and sets statuses only.
  • Connect a self-managed GitLab server. GitLab means GitLab.com.
  • See a GitLab token after you connect it.

Troubleshooting

MessageWhat to do
That GitHub connection could not be verified — it may have expired. Try connecting again.More than 10 minutes passed, or the link came from another browser. Press Connect GitHub again.
That installation is not one your GitHub account can reach, so it was not connected.Install the App on the account you want watched, and connect while signed in to GitHub as someone who can reach it.
GitHub could not be reached to confirm that installation is yours, so nothing was connected.Try again in a moment.
Connecting works, but reviews stay off until the Entropix team finishes the GitHub App.The portal's GitHub App is not fully set up. Ask the people who run your portal.
GitLab didn't accept that token. It may be mistyped, expired or revoked — create a new one and paste it again.Make a new token and paste it.
GitLab knows that token, but it can't do enough. It needs the api scope, and its user needs the Maintainer role in the group.Give the token the api scope and its user the Maintainer role.
This group's access token has expired. Nothing this installation does will work until it is replaced.Make a new token and use Replace token.
GitLab hasn't sent Entropix any events yet. The webhooks may be missing.Disconnect and connect again with a Maintainer token, or add the webhook by hand (above).