Skip to content

Commit 8dc2d6e

Browse files
Update location of typescript definitions (actions#743)
https://github.com/octokit/webhooks.js#typescript
1 parent 3bd7461 commit 8dc2d6e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/github/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ const newIssue = await octokit.rest.issues.create({
5959

6060
## Webhook payload typescript definitions
6161

62-
The npm module `@octokit/webhooks` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
62+
The npm module `@octokit/webhooks-definitions` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
6363

64-
First, install the npm module `npm install @octokit/webhooks`
64+
First, install the npm module `npm install @octokit/webhooks-definitions`
6565

6666
Then, assert the type based on the eventName
6767
```ts
6868
import * as core from '@actions/core'
6969
import * as github from '@actions/github'
70-
import * as Webhooks from '@octokit/webhooks'
70+
import {PushEvent} from '@octokit/webhooks-definitions/schema'
71+
7172
if (github.context.eventName === 'push') {
72-
const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush
73-
core.info(`The head commit is: ${pushPayload.head}`)
73+
const pushPayload = github.context.payload as PushEvent
74+
core.info(`The head commit is: ${pushPayload.head_commit}`)
7475
}
7576
```
7677

0 commit comments

Comments
 (0)