Skip to main content

GitHub Integration

The Cypress Dashboard can integrate your Cypress tests with your GitHub workflow via commit status checks and pull request comments. A project first needs to be setup to record to the Cypress Dashboard to use GitHub integration.

Cypress GitHub App PR
caution

GitHub Integration is dependent on your CI environment reliably providing commit SHA data (typically via an environment variable). This is not a problem for most users, but if you are facing GitHub integration issues with your CI setup, please make sure the git information is being sent properly by following these guidelines. If you are still facing issues after this, please contact us.

GitHub Enterprise

tip
Premium Dashboard Feature

GitHub Enterprise integration is included in our Business and Enterprise paid pricing plans.

To configure the Dashboard integration for your GitHub Enterprise site, first follow the instructions to install via organization integration settings below, then skip to Cypress GitHub Enterprise app installation, and finally enable integration for a project.

Install the Cypress GitHub app

Before you can enable GitHub integration for your Cypress projects, you must first install the Cypress GitHub App. You can start the GitHub App installation process via your organization's settings page or a project's settings page in the Cypress Dashboard.

Install via organization integration settings

  1. Go to the Dashboard Organizations page or open the organization switcher.
  2. Select the organization you wish to integrate with a GitHub account or GitHub organization.
    Select an organization
  3. Visit the selected organization's Integrations page via the side navigation.
    Install Cypress GitHub from Integrations
  4. Click the Install GitHub Integration or Install GitHub Enterprise Integration button.

Install via project settings

caution

This installation method is not applicable to GitHub Enterprise.

  1. Select your organization in the organization switcher.
    Select an organization
  2. Select the project you wish to integrate with a GitHub repository.
    Select a project
  3. Go to the project's settings page.
    Visit project settings
  4. Scroll down to the GitHub Integration section.
  5. Click the Install the Cypress GitHub App button.
    Install GitHub Cypress App

Cypress GitHub app installation process

Once you've started the GitHub App installation process via a Cypress organization's settings or a project's settings, you will be directed to GitHub.com to complete the installation:

  1. Select the desired GitHub organization or account to integrate with your Cypress Dashboard organization.

    Select a GitHub organization
  2. Choose to associate All repositories or only select GitHub repositories with your Cypress GitHub App installation.

    Select All GitHub repositories
info

All current and future repositories will be included with this installation if you choose All repositories.

Select specific GitHub repositories
  1. Click the Install button to complete the installation.

Cypress GitHub Enterprise app installation process

To integrate the Dashboard with GitHub Enterprise, you need to create a new GitHub App, copy the necessary settings and credentials from the new app, paste them into the Dashboard, and complete the activation process.

  1. With your Dashboard organization's GitHub Enterprise page open, open a new tab or browser window and browse to your GitHub Enterprise site. Navigate to your GitHub organization → SettingsDeveloper settingsGitHub Apps. Do NOT go to OAuth Apps. Click the New GitHub App button.
Create new GitHub App
  1. Complete the Register new GitHub app section.
Configure new GitHub App
  1. Complete the Webhook section.
Configure app webhook
  1. Set the Repository Permissions. Below are the minimum permissions required for the new GitHub App.
    • Pull requests: read & write
    • Commit statuses: read & write
Configure app permissions
  1. Skip to the bottom of the form and click the Create GitHub App button. Your new GitHub App is now created, and you'll be taken to the settings page.

  2. Returning to the Cypress Dashboard GitHub Enterprise Integration configuration screen, populate the following values from your new GitHub App.

    • Copy the root URL of your GitHub Enterprise site to the Cypress GitHub Enterprise Server URL field.
    • Copy the App ID to the Cypress GitHub Enterprise App ID field.
    • Copy the Client ID to the Cypress GitHub Enterprise Client ID field.
    • Copy the GitHub App name to the Cypress GitHub Enterprise App name field.
    • Generate a new Client secret in GitHub by clicking on the Generate a new client secret button. Copy the new secret into the Cypress GitHub Enterprise Client secret field.
    • Generate a new private key in GitHub by clicking on the Generate a private key button. Open in a text editor and copy all of the content into the Cypress GitHub Enterprise Private key field.
Collect new app info
Generate client secret
Generate private key
  1. In the Cypress Dashboard, click the Next Step button and you will be taken to the GitHub Enterprise app authorization page. Click the Authorize [your app name] button.
Authorize GitHub App
  1. On your newly-authorized GitHub App, click the Install button.
Install GitHub App
  1. Nearly there! On the GitHub App installation page, choose whether you want to install the app against all repos or select specific ones, then click the Install button.
Confirm installation of GitHub App
  1. Finally you will be returned to the Dashboard. Congratulations, you have installed the Cypress Dashboard GitHub Enterprise integration! You are now ready to configure a GitHub Integration for a project.

Enabling GitHub integration for a project

After completing the Cypress GitHub App installation for your organization you can now enable GitHub Integration for any Cypress project.

  1. Go to the project's settings page.

    Visit project settings
  2. Scroll down to the GitHub Integration or GitHub Enterprise Integration section.

info

You can quickly get to a project's GitHub Integrations settings, by clicking on the Configure link of the desired project within an organization's Integrations page:

Org GitHub Integration settings
  1. Select a GitHub repository to associate with the project.
Associate GitHub repo with Cypress project

Once a GitHub repository is associated with a Cypress project, the GitHub integration will be immediately enabled:

GitHub integration enabled for Cypress project

You can also see all GitHub Integration enabled Cypress projects within your organizations Integrations page:

Integrations page

Status checks

If status checks are enabled within a project's GitHub integration settings, the Cypress Dashboard will report Cypress test statuses to GitHub for related commits. Status checks help prevent merging a commit or pull-request into the rest of your codebase until all your Cypress tests have passed.

The Cypress GitHub App reports commit status checks in two separate styles:

  • One check per run group.

    Status checks per group
  • Or one check per spec file.

    Status checks per spec

Each status check will report the number of test failures or passes, and the associated Details link will direct you to the test run's page within the Cypress Dashboard to help you dig deeper into the problem via error messages, stack traces, screenshots, and video recordings:

Cypress Dashboard failure tab

Disable status checks

GitHub status checks are optional, and can be disabled within a project's GitHub integration settings:

Status checks settings

Pull request comments

The Cypress GitHub App can provide detailed test information within pull requests via comments that include:

  • Run statistics, such as tests passed, failed, skipped, and over-limit.
  • Run context details:
    • The associated Cypress project
    • Final run status (passed, failed, etc)
    • Commit SHA linking to the GitHub commit
    • The time the run started and finished as well as the duration.
    • Operating system version and browser version.
  • Run failures:
    • The first 10 failures are displayed with a link to more.
    • Each failed test links back to the associated failure within the Cypress Dashboard.
    • Screenshot thumbnails are also provided with each failure to conveniently provide context.

An example of a Cypress pull-request comment can be seen below:

Cypress GitHub App PR comment

Disable PR comments

PR comments and failure screenshot thumbnails are optional, and can be disabled if not needed within a project's GitHub Integration settings:

Status checks settings

Uninstall the Cypress GitHub app

You can uninstall the Cypress GitHub app from GitHub by performing the following steps:

  1. Go into your organization's Settings from within GitHub.
  2. Click on Installed GitHub Apps.
  3. Click Configure beside the Cypress app.
  4. Click Uninstall below the "Uninstall Cypress" section.

Troubleshooting

See Common GitHub Actions Problems and Solutions.

See also