Skip to content

Commit f065479

Browse files
committed
Merge branch 'master' into 180-docs-gitlab
# Conflicts: # README.md
2 parents 66a158f + 2fb790a commit f065479

14 files changed

+83
-32
lines changed

README.md

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,50 @@ At the moment GitLab's webhooks don't support as many events. So far, we support
4343
- Opened
4444
- Merged
4545

46-
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
46+
## Setup
47+
48+
There are a few requirements for the integration to work.
4749

48-
## Manual deploy
50+
- [ ] Your webhook is on a server, running 24/7
51+
- [ ] Your webhook is able to receive HTTP requests from GitHub/GitLab.
52+
- [ ] Your repository (and/or user/organisation) on GitHub/GitLab is configured to notify your
53+
webhook
54+
55+
You can deploy this webhook in different ways
4956

5057
### Deploy to Heroku
5158

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

5991
## Configuration
6092

@@ -63,17 +95,36 @@ We make use of the following environment variables:
6395
| Variable | Setting | Mandatory | Default |
6496
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------- |
6597
| PORT | Where the HTTP server should listen. | No | `8080` |
66-
| 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_ |
67-
| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | **Yes** | _empty_ |
68-
| 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_ |
69-
| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | **Yes** | _empty_ |
70-
| 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_ |
71-
| 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_ |
72-
| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | **No** | _empty_ _array_ |
73-
74-
## How to configure the webhook in GitHub
75-
76-
### For sponsorships
98+
| 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_ |
99+
| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | No | _empty_ |
100+
| 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_ |
101+
| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | No | _empty_ |
102+
| 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_ |
103+
| 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_ |
104+
| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | No | _empty_ _array_ |
105+
106+
### GitHub Configuration
107+
108+
#### Repositories
109+
110+
0. Open your repository settings on GitHub.
111+
1. Go to the **Webhooks** section.
112+
2. Click on **Add webhook**.
113+
3. On the **Payload** field, enter the GitHub endpoint for your deployed webhook. For example `https://YOUR-SITE-HERE.herokuapp.com/github`.
114+
4. For **Content type** we want to select `application/json`.
115+
5. On **Which events would you like to trigger this webhook?** select `Let me select individual events`.
116+
6. On the list of events check the following:
117+
- Check runs
118+
- Forks
119+
- Issues
120+
- Pull requests
121+
- Releases
122+
- Stars
123+
7. Make sure the `Active` checkbox is checked
124+
8. Click on `Add webhook`
125+
9. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly.
126+
127+
#### Sponsorships
77128

78129
[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)
79130

@@ -89,7 +140,7 @@ Everyone is welcome to contribute to this repository. To do so follow these step
89140

90141
### Deploying to Heroku
91142

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

94145
### Configuring your local repo to deploy on Heroku
95146

lint-staged.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
'*.{ts,js}': ['yarn format', 'yarn lint'],
3-
'*.{md}': ['yarn format'],
3+
'*.md': ['yarn format'],
44
};

test/builders/release-created-payload-builder.spec.ts renamed to test/builders/github/release-created-payload-builder.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReleaseCreatedPayloadBuilder } from './release-created-payload-builder';
2-
import { ReleaseCreatedPayload } from '../../src/schemas/github/release-created-payload';
2+
import { ReleaseCreatedPayload } from '../../../src/schemas/github/release-created-payload';
33

44
describe('ReleasePayloadBuilder', () => {
55
describe('#constructor', () => {

test/builders/release-created-payload-builder.ts renamed to test/builders/github/release-created-payload-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReleaseCreatedPayload } from '../../src/schemas/github/release-created-payload';
1+
import { ReleaseCreatedPayload } from '../../../src/schemas/github/release-created-payload';
22
import { merge } from 'lodash';
33

44
export class ReleaseCreatedPayloadBuilder {

test/builders/sponsorship-payload-builder.ts renamed to test/builders/github/sponsorship-payload-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SponsorshipPayload } from '../../src/schemas/github/sponsorship-payload';
1+
import { SponsorshipPayload } from '../../../src/schemas/github/sponsorship-payload';
22
import { internet, random } from 'faker';
33
import { merge } from 'lodash';
44

test/builders/payload/gitlab/merge-request-payload-builder.ts renamed to test/builders/gitlab/merge-request-payload-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MergeRequestPayload } from '../../../../src/schemas/gitlab/merge-request-payload';
1+
import { MergeRequestPayload } from '../../../src/schemas/gitlab/merge-request-payload';
22
import { merge } from 'lodash';
33

44
export class MergeRequestPayloadBuilder {

test/reactions/github/issue-assigned.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Config } from '../../../src/config';
22
import { IssueAssigned } from '../../../src/reactions/github/issue-assigned';
33
import { IssuePayload } from '../../../src/schemas/github/issue-payload';
4-
import { IssuePayloadBuilder } from '../../builders/payload/issue-payload-builder';
4+
import { IssuePayloadBuilder } from '../../builders/github/issue-payload-builder';
55
import { StreamLabsMock } from '../../__mocks__/StreamLabs';
66
import { TwitchChatMock } from '../../__mocks__/TwitchChat';
77

test/reactions/github/release-created.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ReleaseCreated } from '../../../src/reactions/github/release-created';
22
import { TwitchChatMock } from '../../__mocks__/TwitchChat';
33
import { StreamLabsMock } from '../../__mocks__/StreamLabs';
44
import { ReleaseCreatedPayload } from '../../../src/schemas/github/release-created-payload';
5-
import { ReleaseCreatedPayloadBuilder } from '../../builders/release-created-payload-builder';
5+
import { ReleaseCreatedPayloadBuilder } from '../../builders/github/release-created-payload-builder';
66

77
describe('ReleaseCreated', () => {
88
let twitchChat: TwitchChatMock;

test/reactions/github/sponsorship-created.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SponsorshipPayloadBuilder } from '../../builders/sponsorship-payload-builder';
1+
import { SponsorshipPayloadBuilder } from '../../builders/github/sponsorship-payload-builder';
22
import { StreamLabsMock } from '../../__mocks__/StreamLabs';
33
import { TwitchChatMock } from '../../__mocks__/TwitchChat';
44
import { SponsorshipCreated } from '../../../src/reactions/github/sponsorship-created';

0 commit comments

Comments
 (0)