From 39725fc5b8b3cc0086ea416299265a71923c9e7a Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sat, 2 May 2020 23:27:19 +0200 Subject: [PATCH 1/6] docs: Add deployment and GitHub configuration guide Resolves #125 --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2e51411..6efc66c 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,52 @@ A webhook to forward GitHub events to StreamLabs Alerts and Twitch Chat. [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) -## Manual deploy + +## Setup -``` -git clone https://github.com/streamdevs/webhook.git -cd webhook -yarn -yarn start -``` +There are a few requirements for the integration to work. + +- [ ] Your webhook is on a server, running 24/7 +- [ ] Your webhook is able to receive HTTP requests from GitHub/GitLab. +- [ ] Your repository (and/or user/organisation) on GitHub/GitLab is configured to notify your + webhook + +You can deploy this webhook in different ways + +### Deploy to Heroku + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) ## Configuration +### Deploy to your own server + +0. Get the source code + ``` + git clone https://github.com/streamdevs/webhook.git + ``` +0. Change into the source code directory + ``` + cd webhook + ``` +0. Install the dependencies with yarn (or alternative you can use `npm`) + ``` + yarn install + ``` + ``` +0. Create a .env file with your (configuration)[#configuration] and the edit it + ``` + cp .env.example .env + ``` +0. Compile the project to JavaScript + ``` + yarn build + ``` +0. Run the start command + ``` + yarn run start + ``` +0. You should see your webhook running on the port specified in the configuration below + We make use of the following environment variables: @@ -45,6 +81,29 @@ We make use of the following environment variables: ### For sponsorships +### GitHub Configuration + +#### Repositories + +0. Open your repository settings on GitHub. +0. Go to the **Webhooks** section. +0. Click on **Add webhook**. +0. On the **Payload** field, enter the GitHub endpoint for your deployed webhook. For example `https://YOUR-SITE-HERE.herokuapp.com/github`. +0. For **Content type** we want to select `application/json`. +0. On **Which events would you like to trigger this webhook?** select `Let me select individual + events`. +0. On the list of events check the following: + - Check runs + - Forks + - Issues + - Pull requests + - Releases + - Stars +0. Make sure the `Active` checkbox is checked +0. Click on `Add webhook` +0. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly. + + [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) ## Contributing From c97e6e5c984d4d850bdf42428a5ce64dc809d78d Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sat, 2 May 2020 23:53:41 +0200 Subject: [PATCH 2/6] docs: Whitespace --- README.md | 96 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 6efc66c..cfb0fa8 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,15 @@ A webhook to forward GitHub events to StreamLabs Alerts and Twitch Chat. [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) - ## Setup There are a few requirements for the integration to work. - -- [ ] Your webhook is on a server, running 24/7 + +- [ ] Your webhook is on a server, running 24/7 - [ ] Your webhook is able to receive HTTP requests from GitHub/GitLab. - [ ] Your repository (and/or user/organisation) on GitHub/GitLab is configured to notify your - webhook - + webhook + You can deploy this webhook in different ways ### Deploy to Heroku @@ -34,35 +33,40 @@ You can deploy this webhook in different ways [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) ## Configuration + ### Deploy to your own server 0. Get the source code - ``` - git clone https://github.com/streamdevs/webhook.git - ``` -0. Change into the source code directory - ``` - cd webhook - ``` -0. Install the dependencies with yarn (or alternative you can use `npm`) - ``` - yarn install - ``` - ``` -0. Create a .env file with your (configuration)[#configuration] and the edit it - ``` - cp .env.example .env - ``` -0. Compile the project to JavaScript - ``` - yarn build - ``` -0. Run the start command - ``` - yarn run start - ``` -0. You should see your webhook running on the port specified in the configuration below + ``` + git clone https://github.com/streamdevs/webhook.git + ``` +1. Change into the source code directory + ``` + cd webhook + ``` +2. Install the dependencies with yarn (or alternative you can use `npm`) + + ``` + yarn install + ``` + ``` + + ``` + +3. Create a .env file with your (configuration)[#configuration] and the edit it + ``` + cp .env.example .env + ``` +4. Compile the project to JavaScript + ``` + yarn build + ``` +5. Run the start command + ``` + yarn run start + ``` +6. You should see your webhook running on the port specified in the configuration below We make use of the following environment variables: @@ -86,23 +90,21 @@ We make use of the following environment variables: #### Repositories 0. Open your repository settings on GitHub. -0. Go to the **Webhooks** section. -0. Click on **Add webhook**. -0. On the **Payload** field, enter the GitHub endpoint for your deployed webhook. For example `https://YOUR-SITE-HERE.herokuapp.com/github`. -0. For **Content type** we want to select `application/json`. -0. On **Which events would you like to trigger this webhook?** select `Let me select individual - events`. -0. On the list of events check the following: - - Check runs - - Forks - - Issues - - Pull requests - - Releases - - Stars -0. Make sure the `Active` checkbox is checked -0. Click on `Add webhook` -0. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly. - +1. Go to the **Webhooks** section. +2. Click on **Add webhook**. +3. On the **Payload** field, enter the GitHub endpoint for your deployed webhook. For example `https://YOUR-SITE-HERE.herokuapp.com/github`. +4. For **Content type** we want to select `application/json`. +5. On **Which events would you like to trigger this webhook?** select `Let me select individual events`. +6. On the list of events check the following: + - Check runs + - Forks + - Issues + - Pull requests + - Releases + - Stars +7. Make sure the `Active` checkbox is checked +8. Click on `Add webhook` +9. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly. [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) From 1802a841a36dac64405e3c5525dbdc8905f44c3f Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sun, 3 May 2020 18:35:36 +0200 Subject: [PATCH 3/6] fix(docs): Fix readme order --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b4a3236..73c3cf3 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,6 @@ You can deploy this webhook in different ways [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) -## Configuration - ### Deploy to your own server 0. Get the source code @@ -69,6 +67,7 @@ You can deploy this webhook in different ways ``` yarn install ``` + 3. Create a .env file with your (configuration)[#configuration] and the edit it ``` cp .env.example .env @@ -83,6 +82,8 @@ You can deploy this webhook in different ways ``` 6. You should see your webhook running on the port specified in the configuration below +## Configuration + We make use of the following environment variables: | Variable | Setting | Mandatory | Default | @@ -96,8 +97,6 @@ We make use of the following environment variables: | 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_ | | NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | **No** | _empty_ _array_ | -## How to configure the webhook in GitHub - ### GitHub Configuration #### Repositories @@ -119,7 +118,7 @@ We make use of the following environment variables: 8. Click on `Add webhook` 9. You will receive your first notification on Twitch Chat and StreamLabs letting you now your webhook has been configured correctly. -### For sponsorships +#### Sponsorships [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) From 60ab6af32a309f8fb4e7f7bb84c58342ad51efc2 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sun, 3 May 2020 18:40:05 +0200 Subject: [PATCH 4/6] fix(docs): Update mandatory variables --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 73c3cf3..74b709d 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,13 @@ We make use of the following environment variables: | Variable | Setting | Mandatory | Default | | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------- | | PORT | Where the HTTP server should listen. | No | `8080` | -| 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_ | -| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | **Yes** | _empty_ | -| 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_ | -| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | **Yes** | _empty_ | -| 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_ | -| 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_ | -| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | **No** | _empty_ _array_ | +| 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_ | +| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | No | _empty_ | +| 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_ | +| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | No | _empty_ | +| 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_ | +| 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_ | +| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | No | _empty_ _array_ | ### GitHub Configuration From e0ddc43e463cc76b8e6153cd0bef3a3ba6d6645f Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sun, 3 May 2020 18:40:47 +0200 Subject: [PATCH 5/6] docs: Remove redundant 'Deploy to Heroku' button --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 74b709d..836d966 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,6 @@ We support the following events: - Opened - Merged -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) - ## Setup There are a few requirements for the integration to work. @@ -134,7 +132,7 @@ Everyone is welcome to contribute to this repository. To do so follow these step ### Deploying to Heroku -You can use the "[deploy to Heroku](#webhook)" button link at the top of this readme file or use the Heroku CLI +You can use the "[deploy to Heroku](#deploy-to-heroku)" button or use the Heroku CLI ### Configuring your local repo to deploy on Heroku From dc1014c5fcfb868c1089a04f2d71b128fb23c313 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Sun, 3 May 2020 18:41:41 +0200 Subject: [PATCH 6/6] chore(docs): Whitespace --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 836d966..c7329e5 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,13 @@ We make use of the following environment variables: | Variable | Setting | Mandatory | Default | | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------- | | PORT | Where the HTTP server should listen. | No | `8080` | -| 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_ | -| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | No | _empty_ | -| 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_ | -| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | No | _empty_ | -| 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_ | -| 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_ | -| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | No | _empty_ _array_ | +| 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_ | +| TWITCH_BOT_NAME | The account (username) that the chatbot uses to send chat messages. | No | _empty_ | +| 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_ | +| TWITCH_BOT_CHANNEL | The Twitch channel name where you want to run the bot. Usually this is your main Twitch account. | No | _empty_ | +| 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_ | +| 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_ | +| NOTIFY_CHECK_RUNS_FOR | Comma-separated list of branches to notify Check Runs for. Leave empty to notify for any branch | No | _empty_ _array_ | ### GitHub Configuration