Skip to content

Commit 02350b2

Browse files
authored
Refactor GitLab webhook script section for clarity and formatting (#447)
* Refactor GitLab webhook script section for clarity and formatting * Clarify comments in gitlab-webhook.sh regarding PAT usage examples * Clarify description of the webhook script usage in GitLab documentation * Fix formatting for selecting triggers in GitLab webhook documentation
1 parent 07ae251 commit 02350b2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/self-hosted/gitlab.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,25 @@ Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.
3737
1. **Navigate to Add Webhook Page**: Go to the webhook configuration page in the desired GitLab project.
3838
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`).
3939
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).
40-
4. Select triggers:
40+
4. **Select triggers**:
4141

4242
- Push events
4343
- Comments
4444
- Issues events
4545
- Merge request events
4646

47-
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:
47+
## Add Webhook Using a Script
48+
49+
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.
4850

4951
```bash
5052
# Make sure the script is executable:
5153
chmod +x gitlab-webhook.sh
54+
```
5255

56+
Example usage:
57+
58+
```bash
5359
# PAT example (header auto-detected)
5460
export GITLAB_TOKEN="glpat-xxxxx"
5561
./gitlab-add-webhook.sh \

static/code/gitlab-webhook.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
# Make sure the script is executable:
88
# chmod +x gitlab-webhook.sh
99

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

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

0 commit comments

Comments
 (0)