Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🦊 Add gitlab support #295

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file modified images/gitlab/gitlab-project-access-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gitlab/gitlab-project-id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gitlab/gitlab-project-webtoken-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gitlab/gitlab-project-webtoken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gitlab/gitlab-show-webtoken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 61 additions & 10 deletions settings/gitlab.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,81 @@ icon: 'gitlab'
GitLab integration is available on the [Enterprise plan](https://mintlify.com/pricing).
</Check>

<Steps>
We use a combination of Access tokens and Webhooks to authenticate and sync changes between GitLab and Mintlify.

* We use Access tokens to pull information from GitLab Mintlify.
* We use Webhooks so GitLab can notify Mintlify when changes are made.
* This allows Mintlify to create preview deployments when a MR is created.

<Steps title="In Mintlify">
<Step title="Begin Setup">
Within your Mintlify dashboard, click on the `Settings` tab and select [`Git Settings`][git-settings].
</Step>
<Step title="Switch to GitLab">
Click on `Switch to GitLab` which will open a panel to enter your GitLab information.
</Step>
</Steps>

<Steps title="In GitLab">
<Step title="Find your project ID">
Navigate to your project's `Settings` > `General` and find the Project ID.
In another tab, navigate to your GitLab's project `Settings` > `General` and find the `Project ID`.
<Frame>
<img src="/images/gitlab/gitlab-project-id.png" />
</Frame>
</Step>
<Step title="Generate a project private token">

a. Navigate to your project's `Settings` > `Access Tokens`.
<Step title="Generate an Access token">
a. Navigate to your GitLab's project `Settings` > `Access Tokens`.

b. Select `Add new token`.
1. Name the token "Mintlify" - this specific name is important as it will be visible when we make changes on our end.
2. Choose `read_api` for the scopes.
3. If you have a private repo, you must set the role as `Reporter`.
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.

<Frame>
<img src="/images/gitlab/gitlab-project-access-token.png" />
</Frame>
</Step>

<Step title="Create the webhook">
a. Navigate to your GitLab's project `Settings` > `Webhooks`.

b. In the "URL" field, enter the endpoint `https://leaves.mintlify.com/gitlab-webhook`

c. Name the webhook "Mintlify".

d. Paste the Webhook token generated after completing the previous steps.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a screenshot of the product here highlighting the "Show Webtoken".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abs, on it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

<Frame>
<img src="/images/gitlab/gitlab-show-webtoken.png" />
</Frame>

e. Select the events you want to trigger the webhook:
- Push events (All branches)
- Merge requests events

f. Click `Add webhook`.
<Frame>
<img src="/images/gitlab/gitlab-project-webtoken.png" />
</Frame>
</Step>
<Step title="Reach out to the Mintlify team for final setup.">
Contact us [here](https://mintlify.com/enterprise).
<Step title="Test the Webhook">
After creating the Webhook:

a. Click the "Test" dropdown and select "Push events" to send a sample payload to ensure it's configured correctly.

b. Check your Mintlify dashboard to view the status of your GitLab integration and confirm that the test event was received successfully.

This will help you verify that everything is working correctly and that your documentation will sync properly with your GitLab repository.
<Frame>
<img src="/images/gitlab/gitlab-project-webtoken-test.png" />
</Frame>
</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