> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Learn how to connect your GitHub repository to your Openlayer project

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/github_hero.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=9faa1078ca74166604ec6a77ec0f7c56" alt="GitHub hero" data-path="images/integrations/github_hero.png" />

If you use [GitHub](https://github.com/) to version control your AI system, you can
connect its repository to your Openlayer project. By doing so, every push or pull request to a pre-defined branch triggers
the evaluation of your Openlayer tests.

This is the most common way to set up Openlayer's [development mode](/development/overview).
In this case, Openlayer works as a step in your CI/CD pipeline.

## Connecting GitHub account

The first step is connecting your GitHub account to Openlayer. To do so, navigate to
"Settings" > "Integrations." Click "Enable" next to the GitHub integration section.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/enable_github_integration.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=1975e06f8250b037e42c5da68d47280a" alt="Enabling the GitHub integration" data-path="images/integrations/enable_github_integration.png" />

After clicking "Enable," a window should pop up asking you to log in. Follow the instructions
on the screen to log into your GitHub account and select the organization where the Openlayer
GitHub app should be installed.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/login_github.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=fc2545faacfd305fe0b5641eac284dbe" alt="Logging into GitHub" data-path="images/integrations/login_github.png" />

Once a GitHub account is successfully connected to your GitHub account, you should see a
"Manage" button, instead of "Enable."

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/manage_github_integration.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=909eab30c466d913850eb9e0a78ca913" alt="Managing the GitHub integration" data-path="images/integrations/manage_github_integration.png" />

## Linking a GitHub repo to a project

Now that your GitHub account is connected to your Openlayer workspace, you can link
a repo to an Openlayer project. You have two options:

<AccordionGroup>
  <Accordion title="Create a new project and link Git repo">
    If you [follow the instructions to create a new project](/workspace-and-projects/creating-and-loading-projects), you should see the option to
    link a GitHub repo right away.

    <img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/new_project_link.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=2858522f441b1fab0ee717b51aa2845f" alt="Link project to GitHub" data-path="images/integrations/new_project_link.png" />

    Click "Connect" next to the repo you want to link to the project.
  </Accordion>

  <Accordion title="Link Git repo to an existing project">
    Navigate to "Settings," and then scroll down on the left sidebar to the
    project settings. Under the project you want to link a GitHub repo to, click on
    "Git repository."

    <img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/connect_git_repo_to_project.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=8c9c2234c59cb8f731158c89addfe8b7" alt="Connect GitHub repo" data-path="images/integrations/connect_git_repo_to_project.png" />

    Click "Connect" next to the repo you want to link to the project.
  </Accordion>
</AccordionGroup>

In both cases, you will be asked for the:

* **Branch name**: the branch of the Git repo being connected. Pushes and pull requests
  to this branch will trigger the evaluation of your tests.
* **Root directory**: the directory within the Git repo that will get pushed to Openlayer.
  This should be the directory with Openlayer's configurations (such as the [openlayer.json](/development/openlayer-json)).

## Pushing changes

After linking your GitHub repo to your Openlayer project, all your pushes and pull requests
to the branch you configured in the previous step will trigger the evaluation of your tests.

In your GitHub repo, you should see the Openlayer app running.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/jN8MTVdaEnRVD4sY/images/documentation/git_passing.png?fit=max&auto=format&n=jN8MTVdaEnRVD4sY&q=85&s=b2afc35c0c8d57592d595ddcc1292624" alt="Tests passing on GitHub" data-path="images/documentation/git_passing.png" />

If you navigate to your Openlayer project in [app.openlayer.com](https://app.openlayer.com),
you should see the connected repo on the left sidebar. Furthermore, if you navigate to the
"Commit leaderboard" page of your project, you should see all the commits to
Openlayer linked to the original GitHub commits.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/commits.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=e78f184d9baaeb01ab6cb55c25b15cc4" alt="Commits overview" data-path="images/integrations/commits.png" />

If you click the three dots on the right, you can view the commit logs. You can see the
logs for all the steps involved and debug any issues associated with test evaluation.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://openlayer-static-assets.s3.us-west-2.amazonaws.com/images/commit_logs.gif" alt="Commit logs" />
