Basker Docs

Sync a theme from GitHub

Connect a custom theme to a GitHub repository branch so that each push updates the theme in Basker

Connect a custom theme to a branch of a GitHub repository. Basker imports the theme from that branch, then syncs it again after each push. A connected theme replaces the ZIP upload workflow for that theme.

You need permission to manage themes, and the plan of the site must include custom themes. On GitHub, you need write access to the repository, and the Basker GitHub App must be installed on it.

Connect a theme

Open the GitHub dialog

Open Design → Themes. Click New, then click Connect with GitHub. The Connect theme from GitHub dialog opens.

Connect your GitHub account

If the dialog shows Connect GitHub account, click it and authorize Basker on GitHub. GitHub sends you back to the theme list. Open the dialog again.

Install the GitHub App

If your repository is not in the list, click Install or manage the Basker GitHub App. Give the App access to the repository on GitHub. Then click Refresh repositories.

Choose the source

Choose the Repository and the Branch. In Theme directory, enter the path of the theme in the repository, for example themes/storefront. Leave it blank when the theme is at the repository root.

Import the theme

Click Import theme. Basker downloads the files, validates them, and adds the theme to the theme library as a draft. The active theme of the site does not change.

The list shows only the repositories where your GitHub account can push and where the Basker GitHub App is installed. Basker does not show archived or disabled repositories.

The theme directory must contain blocks/, layouts/, and templates/, as in a ZIP upload. See Directory structure. Basker gives the new theme the name of the repository.

What starts a sync

EventResult
A push to the connected branchBasker syncs the theme when the push changes a file in the theme directory. A force push, a branch deletion, or a push that lists more commits than GitHub sends always starts a sync.
Sync now on the themeBasker syncs the theme, also when the branch has no new commit.
Change source on the themeBasker saves the new branch or directory and syncs the theme.
The GitHub App is installed, removed, suspended, or given access to other repositoriesBasker syncs each theme connected through that installation.

Basker waits about five seconds before a sync starts. Pushes in that period start one sync. The sync reads the files at the newest commit of the branch. When that commit is the commit of the last successful sync, Basker skips the sync, unless you started it with Sync now or Change source.

How a sync changes the theme

Each successful sync stores the files of the commit as a new revision of the theme. A sync keeps the status of the theme:

  • If the theme is a draft, the sync replaces the draft.
  • If the theme is published, the sync replaces the published version. Basker does not wait for a separate deploy step.

The theme shows its source: the repository, the branch, the directory, the last successful commit, and the time of the last sync.

Basker reads the files from GitHub only. It does not install dependencies, run a build, or read GitHub Actions artifacts or release files. Every file in the theme directory goes into the theme. Basker does not apply .gitignore.

Branches and directories

  • One theme connects to one branch and one directory. Several themes can connect to the same repository, with different branches or directories.
  • To change the branch or the directory, click Change source on the theme. The repository stays the same. To use a different repository, disconnect the theme and connect a new one.
  • Basker syncs with the GitHub identity of the person who connected the theme, or who last changed its source. If that person loses access to the repository, syncs fail.
  • Studio saves on a connected theme go to a new branch. See Studio and custom themes.

Compiled themes

If your theme needs a build step, for example Vite, Svelte, or Tailwind, build it in your own CI and commit the output.

  • Output branch. Commit only the build output to a separate branch, for example basker. Connect the theme to that branch and leave Theme directory blank.
  • Output directory. Commit the output to a directory on the source branch, for example dist/theme. Connect the theme to that branch and enter the directory. Commit the sources and the output together. Basker does not wait for a later build.

The output must have blocks/, layouts/default.liquid, and an index template. Reference compiled files with the asset_url filter. Basker serves only the files in assets/. For an ES module, write the tag yourself, because script_tag gives a classic script:

<script type="module" src="{{ 'components.js' | asset_url }}"></script>

Remove dependency directories, reports, credentials, and large source files from the output. Basker accepts an optional build.json file at the root of the output and does not read its contents.

Limits

The archive limits of a ZIP upload apply to the theme directory: 1,000 files, 1,500 entries, 8 MiB per file, 32 MiB in total, 8 MiB after compression, a path depth of 16, and paths of 512 bytes. The theme directory cannot contain symbolic links or Git submodules. A download from GitHub that takes longer than three minutes fails.

Upload and file writes

A connected theme rejects a ZIP upload and a direct file save with 409:

GitHub-connected themes cannot be modified by upload or file writes. Disconnect GitHub first.

This applies to the admin and to the Partners API upload route. The admin does not show Upload Theme on a connected theme. To update the theme, push to the connected branch.

Disconnect a theme

Click Disconnect GitHub on the theme, then click Disconnect. The theme keeps the files of the last successful sync. Pushes no longer change it. You can then update the theme with a ZIP upload.

When a sync fails

A failed sync does not change the theme. The theme keeps the revision of the last successful sync.

Basker shows a failure in these places:

  • The source on the theme shows Sync failed and the reason.
  • The theme logs get an entry of the type GitHub Sync, GitHub Manual Resync, or GitHub Initial Import, with the commit.
  • Basker sends one email for each failed commit to the person who connected the theme.

When the first import fails, the dialog shows GitHub import failed and the reason. Basker does not create a theme.

Validation follows the rules of a ZIP upload. A critical error stops the sync. Other errors and warnings do not stop it, and the theme gets the warning status. See Validation errors.

MessageCauseFix
Theme validation failed: ...The files have a critical validation error. The message names the file.Fix the file and push again.
The selected theme directory does not existThe branch has no directory at the Theme directory path.Click Change source and correct the path.
Invalid GitHub theme directoryThe path starts with /, contains .. or .git, or is too long.Enter a relative path such as themes/storefront.
Invalid GitHub branchThe branch name is not a valid Git branch name.Choose a branch from the list.
Theme directories cannot contain symlinks or submodulesThe theme directory has a symbolic link or a submodule.Replace it with the files.
Unsafe GitHub theme file pathA file name in the theme directory is not safe to extract.Rename the file.
GitHub theme has too many entries, GitHub theme size exceeds limits, GitHub theme path exceeds limits, GitHub theme nesting exceeds limits, GitHub directory listing exceeds theme limits, GitHub theme archive exceeds limitsThe theme directory is larger than a limit.Remove files from the theme directory.
GitHub theme download exceeded time limitsThe download took longer than three minutes.Reduce the number of files, then click Sync now.
GitHub repository write access is requiredYour GitHub account cannot push to the repository, or the repository is archived or disabled.Get write access on GitHub.
Install the Basker GitHub App for this repositoryThe App is not installed on the repository.Install the App and give it access to the repository.
GitHub App access has been removedThe App was removed or suspended.Install the App again.
GitHub repository connection changed; reconnect the sourceThe repository was renamed or moved.Disconnect the theme and connect it again.
GitHub App repository access changedThe App no longer has access to the repository.Give the App access to the repository on GitHub.
This theme is locked to tenant '...' and cannot be uploaded to '...'The tenant lock in config/settings_schema.json does not match the site.Remove or correct the tenant lock.

Some failures from GitHub do not retry. After you fix the cause, push again or click Sync now.

On this page