Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions settings/gitlab.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,46 @@ description: "Sync your docs with a GitLab repo"
icon: "gitlab"
---

We use a combination of Access tokens and Webhooks to authenticate and sync
changes between GitLab and Mintlify.
We use access tokens and webhooks to authenticate and sync changes between GitLab and Mintlify.

- We use Access tokens to pull information from GitLab.
- We use Webhooks so GitLab can notify Mintlify when changes are made.
- This allows Mintlify to create preview deployments when a MR is created.
- Mintlify uses access tokens to pull information from GitLab.
- GitLab uses webhooks to notify Mintlify when changes are made, enabling preview deployments for merge requests.

## Set up the connection

<Steps>
<Step title="Find your project ID">
Within your GitLab project, navigate to `Settings` > `General` and find the `Project ID`.
In your GitLab project, navigate to **Settings** > **General** and locate your **Project ID**.
<Frame>
<img src="/images/gitlab/gitlab-project-id.png" />
<img src="/images/gitlab/gitlab-project-id.png" alt="The General Settings page in the GitLab dashboard. The Project ID is highlighted." />
</Frame>
</Step>
<Step title="Generate an access token">
a. Navigate to `Settings` > `Access Tokens`.

b. Select `Add new token`.
1. Name the token "Mintlify".
2. If you have a private repo, you must set the role as `Maintainer`.
3. Choose `api` and `read_api` for the scopes.

c. Finally click `Create project access token` and copy the token.
Navigate to **Settings** > **Access Tokens** and select **Add new token**.

Configure the token with these settings:
- **Name**: Mintlify
- **Role**: Maintainer (required for private repos)
- **Scopes**: `api` and `read_api`

Click **Create project access token** and copy the token.

<Note>
If Project Access Tokens are not available, you can use a Personal Access Token instead. Note that Personal Access Tokens expire and must be updated.
</Note>

<Frame>
<img src="/images/gitlab/gitlab-project-access-token.png" />
<img src="/images/gitlab/gitlab-project-access-token.png" alt="The Access tokens page in the GitLab dashboard. The settings to configure for Mintlify are highlighted." />
</Frame>

</Step>
<Step title="Set up the connection">
Within the [Mintlify dashboard](https://dashboard.mintlify.com/settings/deployment/git-settings), add the project ID and access token from the previous steps alongside the other configurations. Click "Save Changes" when you're done.
In the [Mintlify dashboard](https://dashboard.mintlify.com/settings/deployment/git-settings):
1. Enter your project ID and access token.
2. Complete any other required configurations.
3. Click **Save Changes**.
<Frame>
<img src="/images/gitlab/gitlab-config.png" />
<img src="/images/gitlab/gitlab-config.png" alt="The Git Settings page in the Mintlify dashboard. The GitLab configuration settings are highlighted." />
</Frame>
</Step>
</Steps>
Expand All @@ -65,13 +70,13 @@ automatically trigger deployments.
</Frame>
</Step>
<Step title="Select events">
Select the events you want to trigger the webhook:
- Push events (All branches)
- Merge requests events
Select these events to trigger the webhook:
- **Push events** (All branches)
- **Merge requests events**

When you're done it should look like this:
<Frame>
<img src="/images/gitlab/gitlab-project-webtoken.png" />
<img src="/images/gitlab/gitlab-project-webtoken.png" alt="The Webhook page in the GitLab dashboard. The settings to configure for Mintlify are highlighted." />
</Frame>
</Step>
<Step title="Test the Webhook">
Expand All @@ -84,10 +89,3 @@ automatically trigger deployments.

</Step>
</Steps>

<Note>
Reach out to the Mintlify team if you need help. Contact us
[here](https://mintlify.com/enterprise).
</Note>

[git-settings]: https://dashboard.mintlify.com/settings/deployment/git-settings