|
1 |
| -# gitlab-webhook-threads |
| 1 | +# gitlab-webhook-threads |
| 2 | + |
| 3 | +ToDo: add a description of what this is. |
| 4 | +## Configuration |
| 5 | + |
| 6 | +### Requirements |
| 7 | + |
| 8 | +- Node.js v16.6.0 or higher |
| 9 | + |
| 10 | +### Building the bot |
| 11 | + |
| 12 | +1. Download or clone the repo (or download the latest `Source Code` zip from the [releases page](https://github.com/LEDBrain/gitlab-webhook-threads/releases) and unpack it) |
| 13 | +2. Edit `.env.example` and add the required configurations (see [configurating](#Config)) |
| 14 | +3. Rename `.env.example` to `.env` |
| 15 | +4. Open a terminal and run `npm install` |
| 16 | +5. Then run `npm run build` |
| 17 | + |
| 18 | +_There will maybe be a Dockerfile in the future_ |
| 19 | + |
| 20 | +### Config |
| 21 | + |
| 22 | +- `DISCORD_TOKEN` - A token for a bot from https://discord.com/developers/applications |
| 23 | +- `CHANNEL_ID` - A channel id from the channel where to create the threads in |
| 24 | +- `GITLAB_ORG_NAME` - The name of your GitLab Org (without any `/` or spaces; can also be a personal username) |
| 25 | +- `PORT` _optional; default is `4000`_ - The port to run the bot on |
| 26 | + |
| 27 | +### Starting the bot |
| 28 | + |
| 29 | +We sugest using [`pm2`](https://pm2.keymetrics.io/) to start the bot. |
| 30 | + |
| 31 | +1. Install `pm2` globally: `npm install -g pm2` |
| 32 | +2. Go to the bot directory. |
| 33 | +3. Run `pm2 start ecosystem.config.js`. |
| 34 | + |
| 35 | +To stop the bot, simply go to the bot directory and run `pm2 stop ecosystem.config.js`. |
| 36 | + |
| 37 | +### Configuring GitLab |
| 38 | + |
| 39 | +1. Go to https://gitlab.com/ |
| 40 | +2. Go to your Group (or Project) -> Settings -> Integrations |
| 41 | +3. Find `Discord Notifications` and click on it |
| 42 | +4. Make sure `Enable integration` is checked |
| 43 | +5. Check every trigger you want to receive notifications for |
| 44 | +6. Fill out `Webhook` with `http://<your_domain>:<your_port>/incoming` (refer to the [configuration](#Config) for the port) |
| 45 | +7. Click `Save changes` |
0 commit comments