Skip to content

Commit 2fb790a

Browse files
authored
Merge pull request #171 from streamdevs/125-docs-install
docs: Add deployment and GitHub configuration guide
2 parents d8be3f7 + dc1014c commit 2fb790a

File tree

1 file changed

+71
-20
lines changed

1 file changed

+71
-20
lines changed

README.md

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,50 @@ We support the following events:
3535
- Opened
3636
- Merged
3737

38-
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
38+
## Setup
39+
40+
There are a few requirements for the integration to work.
3941

40-
## Manual deploy
42+
- [ ] Your webhook is on a server, running 24/7
43+
- [ ] Your webhook is able to receive HTTP requests from GitHub/GitLab.
44+
- [ ] Your repository (and/or user/organisation) on GitHub/GitLab is configured to notify your
45+
webhook
46+
47+
You can deploy this webhook in different ways
4148

4249
### Deploy to Heroku
4350

44-
```
45-
git clone https://github.com/streamdevs/webhook.git
46-
cd webhook
47-
yarn
48-
yarn start
49-
```
51+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
52+
53+
### Deploy to your own server
54+
55+
0. Get the source code
56+
```
57+
git clone https://github.com/streamdevs/webhook.git
58+
```
59+
1. Change into the source code directory
60+
```
61+
cd webhook
62+
```
63+
2. Install the dependencies with yarn (or alternative you can use `npm`)
64+
65+
```
66+
yarn install
67+
```
68+
69+
3. Create a .env file with your (configuration)[#configuration] and the edit it
70+
```
71+
cp .env.example .env
72+
```
73+
4. Compile the project to JavaScript
74+
```
75+
yarn build
76+
```
77+
5. Run the start command
78+
```
79+
yarn run start
80+
```
81+
6. You should see your webhook running on the port specified in the configuration below
5082

5183
## Configuration
5284

@@ -55,17 +87,36 @@ We make use of the following environment variables:
5587
| Variable | Setting | Mandatory | Default |
5688
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------- |
5789
| PORT | Where the HTTP server should listen. | No | `8080` |
58-
| STREAMLABS_TOKEN | A token to use the StreamLabs API. You can get one by using [StreamDevs/streamlabs-token](https://github.com/streamdevs/streamlabs-token) | **Yes** | _empty_ |
59-
| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | **Yes** | _empty_ |
60-
| TWITCH_BOT_TOKEN | The token to authenticate your chatbot. Generate this with https://twitchapps.com/tmi/, while logged in to your chatbot account. The token will be an alphanumeric string. | **Yes** | _empty_ |
61-
| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | **Yes** | _empty_ |
62-
| NOTIFY_ISSUES_ASSIGNED_TO | A comma-separated list of GitHub user names. Only issues assigned to these users will be notified or leave it empty to receive all notifications. | **No** | _empty array_ |
63-
| IGNORE_PR_OPENED_BY | A comma-separated list of GitHub user names. Only PR not opened by these users will be notified or leave it empty to receive all notifications. | **No** | _empty array_ |
64-
| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | **No** | _empty_ _array_ |
65-
66-
## How to configure the webhook in GitHub
67-
68-
### For sponsorships
90+
| STREAMLABS_TOKEN | A token to use the StreamLabs API. You can get one by using [StreamDevs/streamlabs-token](https://github.com/streamdevs/streamlabs-token) | No | _empty_ |
91+
| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | No | _empty_ |
92+
| TWITCH_BOT_TOKEN | The token to authenticate your chatbot. Generate this with https://twitchapps.com/tmi/, while logged in to your chatbot account. The token will be an alphanumeric string. | No | _empty_ |
93+
| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | No | _empty_ |
94+
| NOTIFY_ISSUES_ASSIGNED_TO | A comma-separated list of GitHub user names. Only issues assigned to these users will be notified or leave it empty to receive all notifications. | No | _empty array_ |
95+
| IGNORE_PR_OPENED_BY | A comma-separated list of GitHub user names. Only PR not opened by these users will be notified or leave it empty to receive all notifications. | No | _empty array_ |
96+
| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | No | _empty_ _array_ |
97+
98+
### GitHub Configuration
99+
100+
#### Repositories
101+
102+
0. Open your repository settings on GitHub.
103+
1. Go to the **Webhooks** section.
104+
2. Click on **Add webhook**.
105+
3. On the **Payload** field, enter the GitHub endpoint for your deployed webhook. For example `https://YOUR-SITE-HERE.herokuapp.com/github`.
106+
4. For **Content type** we want to select `application/json`.
107+
5. On **Which events would you like to trigger this webhook?** select `Let me select individual events`.
108+
6. On the list of events check the following:
109+
- Check runs
110+
- Forks
111+
- Issues
112+
- Pull requests
113+
- Releases
114+
- Stars
115+
7. Make sure the `Active` checkbox is checked
116+
8. Click on `Add webhook`
117+
9. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly.
118+
119+
#### Sponsorships
69120

70121
[Check the GitHub documentation](https://help.github.com/en/github/supporting-the-open-source-community-with-github-sponsors/configuring-webhooks-for-events-in-your-sponsored-account)
71122

@@ -81,7 +132,7 @@ Everyone is welcome to contribute to this repository. To do so follow these step
81132

82133
### Deploying to Heroku
83134

84-
You can use the "[deploy to Heroku](#webhook)" button link at the top of this readme file or use the Heroku CLI
135+
You can use the "[deploy to Heroku](#deploy-to-heroku)" button or use the Heroku CLI
85136

86137
### Configuring your local repo to deploy on Heroku
87138

0 commit comments

Comments
 (0)