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
Method to be run each time the event with the passed name is received.
422
424
the <code>handler</code> function can be an async function, throw an error or
423
-
return a Promise. The handler is called with an event object: <code>{id, name, payload}</code>.
425
+
return a Promise. The handler is called with an event object: <code>{id, name, payload, originalRequest}</code>.
424
426
</td>
425
427
</tr>
426
428
</tbody>
@@ -449,7 +451,7 @@ webhooks.onAny(handler);
449
451
<strong>Required.</strong>
450
452
Method to be run each time any event is received.
451
453
the <code>handler</code> function can be an async function, throw an error or
452
-
return a Promise. The handler is called with an event object: <code>{id, name, payload}</code>.
454
+
return a Promise. The handler is called with an event object: <code>{id, name, payload, originalRequest}</code>.
453
455
</td>
454
456
</tr>
455
457
</tbody>
@@ -482,7 +484,7 @@ Asynchronous `error` event handler are not blocking the `.receive()` method from
482
484
<strong>Required.</strong>
483
485
Method to be run each time a webhook event handler throws an error or returns a promise that rejects.
484
486
The <code>handler</code> function can be an async function,
485
-
return a Promise. The handler is called with an error object that has a .event property which has all the information on the event: <code>{id, name, payload}</code>.
487
+
return a Promise. The handler is called with an error object that has a .event property which has all the information on the event: <code>{id, name, payload, originalRequest}</code>.
Custom path to match requests against. Defaults to <code>/api/github/webhooks</code>.
587
589
</td>
588
590
</tr>
591
+
<tr>
592
+
<td>
593
+
<code>pathRegex</code>
594
+
<em>
595
+
RegEx
596
+
</em>
597
+
</td>
598
+
<td>
599
+
600
+
Custom path matcher. If set, overrides the <code>path</code> option.
601
+
Can be used as;
602
+
603
+
```js
604
+
constmiddleware=createNodeMiddleware(
605
+
webhooks,
606
+
{ pathRegex:/^\/api\/github\/webhooks/ }
607
+
);
608
+
```
609
+
610
+
Test the regex before usage, the `g` and `y` flags [makes it stateful](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)!
611
+
612
+
</td>
613
+
</tr>
589
614
<tr>
590
615
<td>
591
616
<code>log</code>
@@ -721,7 +746,7 @@ A union of all possible events and event/action combinations supported by the ev
721
746
722
747
### `EmitterWebhookEvent`
723
748
724
-
The object that is emitted by `@octokit/webhooks` as an event; made up of an `id`, `name`, and `payload` properties.
749
+
The object that is emitted by `@octokit/webhooks` as an event; made up of an `id`, `name`, and `payload` properties, with an optional `originalRequest`.
725
750
An optional generic parameter can be passed to narrow the type of the `name` and `payload` properties based on event names or event/action combinations, e.g. `EmitterWebhookEvent<"check_run" | "code_scanning_alert.fixed">`.
0 commit comments