Skip to content

Conversation

@thboop
Copy link
Collaborator

@thboop thboop commented Jan 15, 2020

Related to #147

## Webhook Payload Typescript Definitions
`@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed.

To do this, first install the npm module `npm install --save @octokit/webhooks`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is --save an option? the docs dont show that option. --save-prod is the default so i dont think we need any save flag at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL npm install now does this by default, but the --save command is supported for back compat (its a no-op). You used to have to --save dependencies otherwise they wouldn't appear in your package.json

});
```

## Webhook Payload Typescript Definitions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider sentence-case rather than title-case. Sentence-case seems to be the common trend, e.g. here

});
```

## Webhook Payload Typescript Definitions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider blank line separating ## header and paragraph (typical markdown style)

## Webhook Payload Typescript Definitions
`@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed.

To do this, first install the npm module `npm install --save @octokit/webhooks`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which version of octokit? it should match package.json

import * as Webhooks from '@octokit/webhooks'
if (github.context.eventName === 'push') {
const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush
core.info(`The head commit is: ${pushPayload}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean pushPayload.head?

```

## Webhook Payload Typescript Definitions
`@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider removing unnecessary words. E.g: The npm module @octokit/webhooks provides complete typescript type definitions for the response payloads associated with each event. You can cast the provided payload to these types for more better type information as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants