1
0
Fork 0

docs: Deprecate @octokit/webhooks-definitions

pull/1662/head
rapsealk 2024-02-19 11:13:16 +09:00
parent 415c42d27c
commit 24b982d65f
1 changed files with 3 additions and 3 deletions

View File

@ -59,15 +59,15 @@ const newIssue = await octokit.rest.issues.create({
## Webhook payload typescript definitions
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.
The npm module `@octokit/webhooks-types` provides type definitions for the response payloads. You can cast the payload to these types for better type information.
First, install the npm module `npm install @octokit/webhooks-definitions`
First, install the npm module `npm install @octokit/webhooks-types`
Then, assert the type based on the eventName
```ts
import * as core from '@actions/core'
import * as github from '@actions/github'
import {PushEvent} from '@octokit/webhooks-definitions/schema'
import {PushEvent} from '@octokit/webhooks-types'
if (github.context.eventName === 'push') {
const pushPayload = github.context.payload as PushEvent