Protect themes with Source Control
Learn how to protect and sync themes using Source Control.
Using protected themes in Source Control, you can safely replicate organization-level theme configurations across multiple instances of Retool. You can use protected themes with any of Retool's supported source control management (SCM) providers:
Protected themes work similarly to protected apps or resources, with a few key differences. Keep in mind the following considerations:
- Themes cannot be deleted or renamed. Protected themes cannot be renamed or deleted. You must unprotect themes before making deletions or name changes.
- Changes are branchless. Unlike with Retool apps, you do not create a branch from which to make changes. Instead, you create a pull request from the theme IDE after you make changes.
Prerequisites
Before you configure protected themes, you must set up your Source Control provider.
Protect themes
To protect a theme and start tracking its changes, you need to merge an initial commit for the theme to your remote repository. Complete the following steps.
- Navigate to an organization-level theme and select Protect theme from the menu
•••
. - Confirm by clicking the Protect theme button. At this point Retool creates a new branch on your SCM provider.
- Click the Open pull request button. You'll be redirected to your SCM provider to create an initial commit for the theme. This commit contains a JSON file with configuration details for your theme. Themes are not protected until your repository contains the JSON file from your initial commit.
- Create the pull request and merge the commit. After you merge this commit, the theme syncs to all other instances.
The following example shows this process using GitHub as the SCM.
Edit protected themes
When you edit a protected theme, you must click Save and click the Open PR button next to the theme to commit your changes. Follow your source control workflow to merge the pull request. After it’s merged, you’ll see the theme in all your instances, with the theme updated as necessary.
While protected themes are managed using source control, you do not create a separate branch on which to make changes.
Unprotect themes
Use the same process to unprotect a theme as you did to protect it.
A theme must be unprotected before you can delete it or rename it.