# GitLab

> Connect GitLab so the Coder can read projects, merge requests, and issues, and open merge requests for review once your house rules are met.

Connect GitLab and the Coder works on your projects the same way it does on GitHub: it reads the project, its merge requests, and its issues, does the work in its own [workspace](/docs/workspaces/files), and hands you a merge request for review.

Both GitLab.com and a self-managed GitLab are supported.

## At a glance

| | |
| --- | --- |
| Category | Source control |
| Status | Available |
| Used by | Coder (available now) |

## What assistants can do

| Ability | How it runs |
| --- | --- |
| Read projects, merge requests, and issues | Reads on its own |
| Read changed files and pipeline results | Reads on its own |
| Open issues | Waits for your Approve |
| Push a branch with the Coder's work | Waits for your Approve (unless your house rules allow it) |
| Open a merge request, a draft by default | Waits for your Approve (unless your house rules allow it) |
| Merge a merge request | Only when your house rules allow it |

## Setup

1. In GitLab, create a personal, project, or group access token with full API access, limited to the projects you want the Coder to use.
2. Open [Integrations](https://stellarfirm.ai/app/integrations) and pick **GitLab**.
3. Paste the token and press **Connect**.
4. Tell the Coder which project to use, for example "work in [group]/[project]", in your first message.

## Permissions

The token needs one scope: full API access. In plain words, that lets the Coder:

- Read the project, its merge requests, issues, and pipeline results.
- Create issues and merge requests.
- Push a branch to the project.

A project or group token keeps that access narrow. Prefer one of those to a personal token when you can.

## Good to know

- **Pushing and merging follow your house rules.** The work becomes a merge request for review, a draft by default on a first run. If your house rules allow it, the Coder can also merge. Pushing a branch waits for your Approve unless your house rules allow it. See [house rules](/docs/ceo/house-rules).
- Your token stays with your StellarFirm workspace and is never shown back to you. The page shows only that it is connected.
- A self-managed GitLab works too. It needs to be reachable from the Coder's workspace, so check your network rules if the clone fails.
- If the clone fails, the job stops as **Blocked** before any coding and says what to fix.

## Prompts

```prompt title="Pick up a ticket"
Coder, GitLab is connected. Pick up the top open issue on [group]/[project], implement it, and open a merge request for review once I Approve.
```

```prompt title="Review a merge request"
Coder, read merge request [number] on [group]/[project], check its pipeline, and tell me what to fix before it merges.
```

```prompt title="Explain a failing pipeline"
Coder, the pipeline on [group]/[project] is failing. Read the latest results, tell me why, and propose the smallest fix.
```

---

Source: https://stellarfirm.ai/docs/integrations/gitlab
