|
3 | 3 |  |
4 | 4 | [](https://opensource.org/licenses/Apache-2.0) |
5 | 5 |
|
6 | | -This is a GitLab(13.2+) bot that utilizes [webhooks](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html) to automate certain tasks: |
| 6 | +This is a GitLab(13.2+) bot that utilizes [webhooks](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html) to automate certain tasks |
| 7 | + |
| 8 | +## Features |
7 | 9 |
|
8 | 10 | #### Verify if the submitters email domain during Merge requests. |
9 | 11 |
|
@@ -54,19 +56,60 @@ This is a GitLab(13.2+) bot that utilizes [webhooks](https://docs.gitlab.com/ee/ |
54 | 56 |
|
55 | 57 | ## How to use |
56 | 58 |
|
57 | | -Starting a Gitlab Bot instance is simple: |
| 59 | +In order to start the GitLab Bot, you'll need to prepare three environment variables: `BOT_GITLAB_USERNAME`, `BOT_GITLAB_URL`, and `BOT_GITLAB_TOKEN`. |
| 60 | + |
| 61 | +- **BOT_GITLAB_USERNAME**: This is your GitLab username, which identifies your account on GitLab. You can find it on your GitLab profile page. **(It is recommended that you create a new user for this, such as `review-bot`.)** |
| 62 | + |
| 63 | +- **BOT_GITLAB_URL**: This is the URL of your GitLab instance. If you're using GitLab.com, the URL will be `https://gitlab.com`. If you're running a self-hosted GitLab instance, use the URL configured for it (e.g., `http://your-gitlab-instance.com`). |
| 64 | + |
| 65 | +- **BOT_GITLAB_TOKEN**: This is `BOT_GITLAB_USERNAME` access token that grants the bot permission to interact with your GitLab instance. You can generate a personal access token by following these steps: |
| 66 | + 1. Log in to your GitLab account. |
| 67 | + 2. Go to your user settings (click on your profile picture at the top right, then select Settings). |
| 68 | + 3. Navigate to `Access Tokens`. |
| 69 | + 4. Generate the token and make sure to save it securely, as it will be visible only once. |
| 70 | + |
| 71 | +#### Starting a Gitlab Bot: |
58 | 72 |
|
59 | 73 | > In Docker version 19, utilizing the "--security-opt seccomp:unconfined" option when running a container with a preconfigured seccomp profile can disable the seccomp filter and allow processes to execute any system call. |
60 | 74 |
|
61 | 75 | ```shell |
62 | 76 | docker run --rm \ |
63 | | --e BOT_GITLAB_USERNAME="Your Gitlab Username" \ |
64 | | --e BOT_GITLAB_URL="Your Gitlab URL" \ |
65 | | --e BOT_GITLAB_TOKEN="Your Gitlab Access Token" \ |
| 77 | +-e BOT_GITLAB_USERNAME="review-bot" \ |
| 78 | +-e BOT_GITLAB_URL="http://your-gitlab-instance.com" \ |
| 79 | +-e BOT_GITLAB_TOKEN="<User review-bot's access token> \ |
66 | 80 | -p 9998:9998 \ |
67 | 81 | coolbeevip/gitlab-bot |
68 | 82 | ``` |
69 | 83 |
|
| 84 | +#### Setting Up a Webhook in GitLab |
| 85 | +
|
| 86 | +To enable the GitLab Bot to respond to events, you need to configure a Webhook in your GitLab project. Follow these steps: |
| 87 | +
|
| 88 | +1. **Open Project View**: |
| 89 | + - Log in to GitLab. |
| 90 | + - In the dashboard, find and click on your project. |
| 91 | +
|
| 92 | +2. **Enter Webhook Settings**: |
| 93 | + - In the left sidebar menu, navigate to `Settings` -> `Webhooks`. |
| 94 | +
|
| 95 | +3. **Add a New Webhook**: |
| 96 | + - Click on the `Add new webhook` button. |
| 97 | +
|
| 98 | +4. **Fill in the Information**: |
| 99 | + - In the form that appears, fill in the following details: |
| 100 | + - **URL**: Enter the address that will receive the Webhook requests, for example, `http://localhost:9998`. |
| 101 | + - **Trigger**: |
| 102 | + - Select the events you want to trigger the Webhook, such as: |
| 103 | + - `Comments` (comment events) |
| 104 | + - `Issues events` (issue events) |
| 105 | + - `Merge request events` (merge request events) |
| 106 | +
|
| 107 | +5. **Save the Webhook**: |
| 108 | + - Click on the `Add webhook` button to save your configuration. |
| 109 | +
|
| 110 | +6. **Test the Webhook (Optional)**: |
| 111 | + - To confirm if the Webhook is set up correctly, locate the newly added Webhook in the Webhooks list and use the `Test` button to send a test request. |
| 112 | +
|
70 | 113 | ## Environment Variables |
71 | 114 |
|
72 | 115 | **`BOT_GITLAB_USERNAME` / `BOT_GITLAB_URL` / `BOT_GITLAB_TOKEN`** |
|
0 commit comments