Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Refactor GitLab webhook script section for clarity and formatting #447

Merged
merged 4 commits into from
Jul 15, 2025
Merged
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
10 changes: 8 additions & 2 deletions docs/self-hosted/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,25 @@ Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.
1. **Navigate to Add Webhook Page**: Go to the webhook configuration page in the desired GitLab project.
2. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/gitlab_webhooks` (e.g., `http://127.0.0.1:8080/gitlab_webhooks`).
3. **Generate and Save Secret Token**: Generate a secret token, add it to the webhook, and store it securely. This will be needed for the `.env` file as `GITLAB_WEBHOOK_SECRET` (you can use a single secret token for all projects).
4. Select triggers:
4. **Select triggers**:

- Push events
- Comments
- Issues events
- Merge request events

We have a convenient [script](/code/gitlab-webhook.sh) to help you add webhooks to all projects in a GitLab instance. You can run it with the following command:
## Add Webhook Using a Script

We have a convenient [script](/code/gitlab-webhook.sh) to help you add webhooks to a project or all projects under a group in a GitLab instance.

```bash
# Make sure the script is executable:
chmod +x gitlab-webhook.sh
```

Example usage:

```bash
# PAT example (header auto-detected)
export GITLAB_TOKEN="glpat-xxxxx"
./gitlab-add-webhook.sh \
Expand Down
4 changes: 2 additions & 2 deletions static/code/gitlab-webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# Make sure the script is executable:
# chmod +x gitlab-webhook.sh

# PAT example (header auto-detected)
# PAT auto-detected header
# export GITLAB_TOKEN="glpat-xxxxx"
# ./gitlab-add-webhook.sh \
# -h "gitlab.example.com" -u "https://ci.example.com/gitlab-hook" \
# -s "mySecret" -p 42

# PAT example (explicit header)
# PAT with explicit header
# ./gitlab-add-webhook.sh \
# -h "gitlab.example.com" -u "https://ci.example.com/gitlab-hook" \
# -s "mySecret" -g "mygroup/mysubgroup/myproject" \
Expand Down