Projects

Connect GitHub

Connect your Spice.ai project to a GitHub repository

Prepare the repository

Before connecting:

  • Admin access: Ensure you have administrative access to the GitHub repository. This level of access is required to install the Spice.ai GitHub app.
  • Repository owner: The repository must belong to the GitHub organization or account that the Connect @<owner> button shows. This owner is usually the name of your Spice.ai org. The repository name can differ from the project name. For example, the project spice.ai/spiceai/demo can connect to github.com/spiceai/demo or to github.com/spiceai/platform.
  • spicepod.yaml: The repository needs a spicepod.yaml in the project's root directory. The root directory is the repository root unless you set another directory when you connect.

To quickly set up a new repository, use the spiceai/spice-app-template as a starting point.

Connect

  1. In the context of the Spice project to connect, navigate to Settings > GitHub, then find the Connect Git Repository section.
  2. Click Connect @<owner> and follow the GitHub App installation instructions.

Ensure that you select all repositories or specifically the repository you intend to connect.

  1. Link the repository:
    • If a repository with the same name as the project exists, click Link Repository.
    • To use a repository with another name, enter its name under Connect an existing repository, then click Connect repository.
    • If no repository exists yet, click Create <owner>/<project>. The owner is the one the Connect @<owner> button shows.
  2. Optional: in Root directory, enter the directory that contains the project, for example projects/demo. Use a path inside the repository, with no leading slash and no ... Leave it empty to use the repository root. The portal warns when it finds no spicepod.yaml in that directory.

Once connected, the section is titled Connected Git Repository and offers a Production Branch selector and a Disconnect button. To change the directory later, edit Root directory in the same settings page and save it.

Repair the connection

The portal checks the org's GitHub App installation, and the project's access to its repository. When GitHub reports one of the problems in the table below, a project connected to a repository shows a banner. When the portal cannot get an answer from GitHub, it shows no banner. When the installation was removed or is suspended, the org page also shows the problem in place of the GitHub link.

ProblemWhat to do
The GitHub App installation for the org was removed.Click Reconnect GitHub and install the app again.
The GitHub App installation for the org is suspended.Click Open GitHub settings and select Unsuspend on GitHub.
The GitHub App cannot read the repository for this project.Click Update repository access and add the repository to the app on GitHub. Or click Connect another repository.

Only an org owner sees the Reconnect GitHub, Open GitHub settings, and Update repository access buttons. Other org members see a message that asks an org owner to make the repair. When the app cannot read the repository, a member or an admin can also click Connect another repository. A viewer cannot connect another repository.

The portal shows Open GitHub settings and Update repository access only when GitHub reports the installation account as a user or an org. If an org owner sees no button, the owner opens the installation settings of the Spice.ai GitHub App on GitHub and makes the change there.

After you make the change on GitHub, the portal refreshes the page when it sees the repair. If it does not see the repair, it shows a message that tells you what to change on GitHub.

Until you repair the connection, a deploy or a resume of the project fails. The Management API returns the same problem as an error code.