Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@actions/GitHub - TypeScript Definition for WebHookPayload is limited #147

Open
warrenbuckley opened this issue Sep 19, 2019 · 3 comments
Open
Labels
enhancement New feature or request github

Comments

@warrenbuckley
Copy link
Contributor

Please can the WebHookPayload interface/type definition be updated to support more properties from GitHub Webhook/payloads such as Push event.

To get details about the commit/s and the files added, modified and deleted, which is useful for a linting tool to know which files to lint, as opposed to running it over an entire repository which could be quite slow if it contains lots of files.

@bryanmacfarlane bryanmacfarlane added the bug Something isn't working label Nov 13, 2019
@tyankatsu0105
Copy link

@thboop
Does this repo's issue help for generating TypeScript's definition?
👀octokit/webhooks.js#87

@thboop thboop added enhancement New feature or request and removed bug Something isn't working labels Jan 24, 2020
@thboop thboop removed their assignment Jan 24, 2020
@thboop
Copy link
Collaborator

thboop commented Jan 24, 2020

I've updated the readme in #310 with information on how to do this manually if the additional type information would be helpful.

If there's a particular field that is missing that would be helpful to add, we can evaluate adding that field.

The WebhookPayload field is a union of all of these individual payloads that can run in actions from the @octokit/webhooks library. For example:

  | Webhooks.WebhookPayloadPush // If the event is "push"
  | Webhooks.WebhookPayloadPullRequest // if the event is "pull_request"
  | Webhooks.WebhookPayloadPullRequestReview // if the event is "pull_request_review"

These types can have overlapping fields, for example both WebhookPayloadPullRequest and WebhookPayloadPullRequestReview contain the field pull_request, each of a different typeWebhookPayloadPullRequestPullRequest and WebhookPayloadPullRequestReviewPullRequest. Both of these types contain different fields and information. Adding all of this information as optional fields, keeping consistent with how this is being done currently, wouldn't be much better then declaring the field as any as there are a large number of fields that may not even correspond to the event you are accessing.

We will evaluate making these types more accessible in a future release. I've re-tagged this as an enhancement.

@tonyhallett
Copy link

See #743

@thboop thboop added the github label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request github
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants