GitLab
Connect MergeGuide to GitLab to run compliance checks on every merge request. Violations are posted as inline comments, and merge request approvals can be blocked until checks pass.Supported Features
- Merge request policy gate (block on violation)
- Inline code comments on violations
- Pipeline status reporting
- GitLab CI template integration
- Self-hosted GitLab support
OAuth App Setup
Create a GitLab OAuth application
In GitLab, go to your group or user Settings > Applications > Add new application.
- Name: MergeGuide
- Redirect URI:
https://portal.mergeguide.ai/integrations/gitlab/callback - Scopes:
api,read_user
Connect in MergeGuide
Go to Settings > Integrations > GitLab > Connect. Enter the Application ID and Secret, then authorize.
Webhook Configuration
MergeGuide registers webhooks automatically during OAuth setup. If you need to register webhooks manually:- In GitLab, go to the repository Settings > Webhooks
- Add a new webhook:
- URL:
https://portal.mergeguide.ai/webhooks/gitlab - Secret Token: Copy from Settings > Integrations > GitLab > Webhook Secret
- Trigger: Merge Request Events, Push Events
- URL:
- Click Add webhook and test the connection
Merge Request Gate
Once connected, MergeGuide posts a status check to every merge request. Configure the gate behavior in Settings > Integrations > GitLab > Gate Settings:| Setting | Options |
|---|---|
| Gate mode | Advisory (comment only) or Blocking (require passing check) |
| Violation severity | Block on Error only, or Error + Warning |
| Comment verbosity | Summary only, or Full violation details |
Blocking MRs
To require the MergeGuide check to pass before merging:- Go to GitLab repository Settings > Merge requests
- Under Merge checks, enable Pipelines must succeed
- MergeGuide reports its check as a pipeline status
GitLab CI Integration
Add MergeGuide to your pipeline using the CI template:Self-Hosted GitLab
MergeGuide supports GitLab self-managed (Community Edition and Enterprise Edition) version 15.0 and later.Configure Self-Hosted URL
- Go to Settings > Integrations > GitLab > Advanced
- Enter your GitLab instance URL:
https://gitlab.example.com - Complete OAuth setup using your instance URL (replace
gitlab.comwith your domain in all URLs above)
Your self-hosted GitLab instance must be network-accessible from MergeGuide’s servers for webhook delivery. If your instance is on a private network, use the MergeGuide CLI instead, which pushes results from inside your network.
API Rate Limits
MergeGuide respects GitLab API rate limits. For high-volume environments (many simultaneous MRs), configure a dedicated service account with higher rate limits or use a GitLab group access token.Inline Comments
MergeGuide posts violation comments directly on the relevant lines in the merge request diff:Troubleshooting
Webhook Not Receiving Events
- In GitLab, go to the repository Settings > Webhooks and click Test on the MergeGuide webhook
- Check the recent deliveries tab for HTTP status codes
- Verify the webhook secret matches Settings > Integrations > GitLab > Webhook Secret in MergeGuide
Check Not Appearing on MR
- Confirm the repository is enabled under Settings > Integrations > GitLab
- Verify the OAuth token has not expired — reconnect if needed
- Check that the MergeGuide app has
apiscope (not justread_user)