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, extraData}</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, extraData}</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, extraData}</code>.
Custom path to match requests against. Defaults to <code>/api/github/webhooks</code>.
587
-
</td>
588
-
</tr>
589
-
<tr>
590
-
<td>
591
-
<code>log</code>
592
-
<em>
593
-
object
594
-
</em>
595
-
</td>
596
-
<td>
589
+
590
+
Can be used as a regular expression;
591
+
592
+
```js
593
+
constmiddleware=createNodeMiddleware(webhooks, {
594
+
path:/^\/api\/github\/webhooks/,
595
+
});
596
+
```
597
+
598
+
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)!
599
+
600
+
</td>
601
+
</tr>
602
+
<tr>
603
+
<td>
604
+
<code>log</code>
605
+
<em>
606
+
object
607
+
</em>
608
+
</td>
609
+
<td>
597
610
598
611
Used for internal logging. Defaults to [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console) with `debug` and `info` doing nothing.
599
612
@@ -721,7 +734,7 @@ A union of all possible events and event/action combinations supported by the ev
721
734
722
735
### `EmitterWebhookEvent`
723
736
724
-
The object that is emitted by `@octokit/webhooks` as an event; made up of an `id`, `name`, and `payload` properties.
737
+
The object that is emitted by `@octokit/webhooks` as an event; made up of an `id`, `name`, and `payload` properties, with an optional `extraData`.
725
738
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