Last updated

Add remote files from GitLab

If your project files are stored in a remote repository on GitLab, you can connect that repository, so you can access and publish those files in Redocly.

To connect a GitLab repository, you must first create a new access token in GitLab. Afterward, you must create a new branch, enter the connection details, and merge the open pull request in Reunite.

Create a new access token in GitLab

Before entering the connection details in Reunite, you need to create and copy a new access token for your account in GitLab. Redocly uses this access token to establish a connection to your repository. GitLab offers multiple types of access tokens. The access token you use needs to have api scope and at least Maintainer role.

See the GitLab documentation for creating the following access token types with the API scope option:

Create a new branch in Reunite

Before you make any changes to your project, you should create a new branch. This new branch is a place where you can make changes without affecting the published site until you are ready. After you have iterated on your changes based on reviews by your team and the updates have been approved, you can merge your changes into the published site.

To create a new branch:

  1. Go to the project editor.

  2. Click the name of the current branch.

    Screenshot where current branch is on project page

  3. Enter the name for your new branch and select Create Branch.

Enter the connection details in Reunite

After you have created a new branch in Reunite, you can add remote content to your project in Reunite using the connection details you have collected from GitLab.

To enter the connection details in Reunite:

  1. In the file tree, select the folder (or click on the empty space to select the root directory) where you want to add the remote content folder.
  2. Select + > New remote folder > Add Git repository.
  3. Enter a name for the new remote content folder and press the Enter or Return key.
  4. From the list of Git providers, select GitLab or a self-managed GitLab instance.
  5. Enter a Credential name for the new GitLab credential.
  6. Enter the Access token you saved from the Create a new access token in GitLab step and select Next.
  7. Select the Namespace > Project > Branch.
  8. (Optional) Select the Folder, if you want to include only a specific folder from the repository.
  9. (Optional) Select the Auto-sync or Auto-merge toggles to turn off either option.
  10. Select Add remote. This action opens a pull request in Reunite automatically. Click the View Pull Request button next to your new branch name to view the pull request.

Merge the open pull request in Reunite

After you enter the connection details in Redocly, a pull request to merge your updates with the default branch opens. When you merge the pull request your changes are added to your main branch and a production deploy is triggered.

To merge the open pull request in Reunite:

  1. Select the View Pull Request button next to your branch name.
  2. Review your updates in the Review tab.
  3. After the tests have run and your pull request has been approved, click the Merge button to merge your updates with the default branch.

Resources