You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-30Lines changed: 32 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ To use Postgres, you will need to install it and configure it:
82
82
I recommend at least skimming the [GitHub webhook documentation](https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks) if you are not familiar with webhooks.
83
83
In order for GitHub's webhooks to reach your triagebot server, you'll need to figure out some way to route them to your machine.
84
84
There are various options on how to do this.
85
-
You can poke holes into your firewall or use a proxy, but you shouldn't expose your machine to the the internet.
85
+
You can poke holes into your firewall or use a proxy, but you shouldn't expose your machine to the internet.
86
86
There are various services which help with this problem.
87
87
These generally involve running a program on your machine that connects to an external server which relays the hooks into your machine.
Where the value in `--secret` is the secret value you place in `GITHUB_WEBHOOK_SECRET` in the `.env` file, and `--repo` is the repo you want to test against.
110
110
111
+
#### ngrok
112
+
113
+
The following is an example of using <https://ngrok.com/> to provide webhook forwarding.
114
+
You need to sign up for a free account, and also deal with configuring the GitHub webhook settings.
115
+
116
+
1. Install ngrok.
117
+
2. Run `ngrok http 8000`. This will forward webhook events to localhost on port 8000.
118
+
3. Configure GitHub webhooks in the test repo you created.
119
+
In short:
120
+
121
+
1. Go to the settings page for your GitHub repo.
122
+
2. Go to the webhook section.
123
+
3. Click "Add webhook"
124
+
4. Include the settings:
125
+
126
+
* Payload URL: This is the URL to your Triagebot server, for example http://7e9ea9dc.ngrok.io/github-hook. This URL is displayed when you ran the `ngrok` command above.
127
+
* Content type: application/json
128
+
* Secret: Enter a shared secret (some longish random text)
129
+
* Events: "Send me everything"
130
+
111
131
### Zulip testing
112
132
113
-
If you are modifying code that sends message to Zulip and want to test your changes, you can register a [new free Zulip instance](https://zulip.com/new/). Before launching the triagebot locally, set the Zulip env vars to connect to your test instance (see example in `.env.sample`).
133
+
If you want a test Zulip instance, you can [register a free one](https://zulip.com/new/). To have your local triagebot talk to this Zulip instance you need to:
134
+
- Configure a (webhook forwarding service)[#configure-webhook-forwarding]
135
+
- Create in your Zulip instance a webhook bot, using the forwarding address created before.
136
+
- Launch your local triagebot setting `ZULIP_WEBHOOK_SECRET` to the webhook bot `key` value (you get that as part of the Zulip webhook bot configuration)
137
+
- Set the other Zulip env vars as needed (see example in `.env.sample`).
114
138
115
-
You can also test Zulip webhooks locally with `curl`. For example, to test the Zulip hooks (commands sent to the
116
-
Triagebot from the Rust lang Zulip), you start the triagebot on `localhost:8000` and then simulate a
117
-
Zulip hook payload:
139
+
You can also simulate a Zulip webhook payload with `cURL`. For example, this is the payload sent to the triagebot server when tagging a Zulip bot in a stream.
-`CMD` is the exact command you would issue @triagebot on Zulip (ex. open a direct chat with the
136
-
bot and send "work show")
159
+
-`CMD` is the full command you would issue on Zulip (ex. `@**triagebot** work show`)
137
160
-`ZULIP_WEBHOOK_SECRET`: can be anything. Must correspond to the env var `$ZULIP_WEBHOOK_SECRET` on your workstation
138
-
-`YOUR_ID`: your GitHub user ID. Must be existing in your local triagebot database (table `users` and as
139
-
foreign key also in `review_prefs`)
140
-
141
-
#### ngrok
142
-
143
-
The following is an example of using <https://ngrok.com/> to provide webhook forwarding.
144
-
You need to sign up for a free account, and also deal with configuring the GitHub webhook settings.
145
-
146
-
1. Install ngrok.
147
-
2. Run `ngrok http 8000`. This will forward webhook events to localhost on port 8000.
148
-
3. Configure GitHub webhooks in the test repo you created.
149
-
In short:
150
-
151
-
1. Go to the settings page for your GitHub repo.
152
-
2. Go to the webhook section.
153
-
3. Click "Add webhook"
154
-
4. Include the settings:
155
-
156
-
* Payload URL: This is the URL to your Triagebot server, for example http://7e9ea9dc.ngrok.io/github-hook. This URL is displayed when you ran the `ngrok` command above.
157
-
* Content type: application/json
158
-
* Secret: Enter a shared secret (some longish random text)
159
-
* Events: "Send me everything"
161
+
-`sender_*`: the Zulip user data sending the message. `sender_id` must be mapped to a GitHub user in this mapping: https://team-api.infra.rust-lang.org/v1/zulip-map.json
0 commit comments