Skip to content

Configuring GitHub integration

Arnold Noronha edited this page Jun 29, 2021 · 4 revisions

The main part of the GitHub integration is notifying your builds about pass/fail of Screenshot tests. This is called the Checks API.

These builds will also show up on your Pull Request. If a screenshot has changed you can Accept the changes in Screenshotbot which will turn the builds back to green.

Screenshotbot does not need access to the contents of your repositories. Screenshotbot only needs the Git SHAs of all your commits, and this will be recorded during the CI runs if you use the provided SDK.

Creating a GitHub Application

In order to use the Checks API, you must first create a GitHub application. You can find this under Settings -> Developer Options -> New GitHub App. The only permission you need is Write Access for Checks. The app does not need to be on GitHub marketplace.

Once you create your app, take note of your App ID. It's usually a five-digit number. Also scroll down the General settings page and click Generate Private Key. Save this key on the same server where Screenshotbot is installed.

Configuring Screenshotbot

Update config.lisp, to enable the GitHub plugin:

(setf (installation) 
      (make-instance 'installation
                     :plugins (list 
                        (make-instance 'github-plugin
                            :app-id app-id-goes-here
                            :private-key-file "/full/path/to/key-file.pem"))))

Update your CI job

At this point, all you need to do is to update your CI job to use the CLI SDK to upload the screenshots. Screenshotbot will look at the Git URL, and if it looks like a GitHub repository, it will automatically send Check results.