Integrating CodeScene with GitHub Checks

You can set up CodeScene to run delta analyses on your GitHub Pull Requests (PRs) and provide automated feedback via quality gates. This ensures that code health and quality standards are enforced early in the development process.


1. Prerequisites

  • Configure the CodeScene host URL under:
    Global Configuration → System → Host/Network Settings.

  • Ensure that your CodeScene instance is accessible from GitHub.

    • If you are running CodeScene locally (trial setup), see the Important Note at the end of this article.


2. Enable PR Integration

  1. On the Projects page in CodeScene, locate your project.

  2. Navigate to Project Configuration → PR Integration.

  3. Enable PR integration and select GitHub App as the integration type.


3. Create and Configure a GitHub App

CodeScene integrates with GitHub via a GitHub App to post quality gate results directly in the PR’s Checks tab.

Steps to Create the GitHub App

  1. In GitHub:

    • For a personal account: click Profile picture → Settings.

    • For an organization: click Profile pictureOrganizations → Click on your organization → Settings.

    • Click on the Developer settings → GitHub Apps.

  2. Click New GitHub App.

  3. Fill in the required fields:

    • GitHub App name: e.g., CodeScene PR Integration.

    • Homepage URL: Required by GitHub; can be set to any valid URL (e.g., https://www.codescene.io/).

    • Webhook: Set to not active (you will activate it later).

    • Repository Permissions:

      • Checks: Read & write

      • Pull requests: Read & write

  4. Click Create GitHub App.

  5. Generate a Private Key by scrolling to the bottom of the page and clicking Generate Private Key (downloads a .pem file).

  6. Click Save Changes.

👉 For full details, see the official GitHub App configuration guide.


4. Configure GitHub App in CodeScene

  1. In CodeScene’s Pull Request Integration tab, choose one of the following:

    • GitHub App Presets (recommended)

      • More information about presets can be found here.

    • Enter the app details manually:

      • App ID. Copy the value from your GitHub App and set it here.

      • Private Key. Select the .pem file you downloaded when creating the App.

      • Webhook Secret. Specify a value that will be used for encrypting webhook calls.

  2. Click Save Configuration.


5. Configure Webhooks on Your GitHub App

  1. Go to your GitHub App configuration page.

  2. Set Webhook to active.

  3. Set the Webhook URL to the value from your CodeScene GitHub App configuration.

  4. Set the Webhook Secret to match the one in CodeScene.

  5. Under Permissions & Events, subscribe to:

    • Check run

    • Check suite

    • Pull request

  6. Click Save Changes.

  7. Install the GitHub App on the desired repositories.

    • CodeScene will now receive webhook events when PRs are created or updated.


6. Customize PR Feedback

Automated Code Health Review & Code Quality Profile

  • Select a code quality profile that fits your project. We recommend starting with the Bare Minimum profile.

  • Can also be configured via Project Configuration → Delta Analysis.

  • Use this link to learn more about quality profiles.


7. Test the Configuration

  1. Create a pull request in GitHub.

  2. Verify that CodeScene posts its review and quality gates in the PR’s Checks tab.


Important Note for On-Premises Trials

When running CodeScene locally:

  • GitHub Apps require inbound communication from GitHub’s servers to your CodeScene instance for webhook delivery.

  • If your instance is not publicly accessible, GitHub cannot deliver events.

Workaround:

  • Use a tunneling service such as ngrok to expose your local or private CodeScene server to the internet.

  • ngrok creates a temporary, secure bridge between GitHub and CodeScene, avoiding changes to your firewall or public IP configuration.