-
Notifications
You must be signed in to change notification settings - Fork 1
Create sample event templates #2
Comments
I copied one of the requests and put the headers in the object to make it work: @bkeepers Any best practices on how to make this more "templatized"? To make sure it works, I've just been putting the response in a Also, do we need to obfuscate the // Here's the example payload
{
"headers": {
"content-type": "application/json",
"Expect": "",
"User-Agent": "GitHub-Hookshot/96d0b6e",
"X-GitHub-Delivery": "99999999999999999999",
"X-GitHub-Event": "issues",
"X-Hub-Signature": "sha1=1f01f01f0f01f01f01f01f01f01f01f0"
},
"body": {
"action": "opened",
"issue": {...},
"repository": {...},
"installation": {
"id": 32078
}
}
} |
Sadly, no. This has actually been common problem with testing Probot plugins. There is so much data in the payload that it makes the surface area very large.
You really only need a few values, plus any other fields that your plugin is using. For example, if you're listening to the {
"headers": {
"X-GitHub-Event": "issues",
},
"body": {
"action": "opened",
"issue": {"number": 999},
"repository": {
"owner": {"login": "username"},
"name": "reponame"
},
"installation": {
"id": 32078
}
}
} One idea is to have Probot normalize the payloads into something easier to construct by hand, and allow it to receive either the full webhook from GitHub, or this normalized form. For example: {
"event": "issues.opened",
"target": "username/reponame#999",
"installation": 32078
}
These aren't actually used by this lambda code right now. The lambda plugin should eventually verify |
Thanks for the context around what's actually needed. That's super helpful. I think a few minimal payload examples would be nice along with some documentation on how to set them up inside your own repo. I'll do some tests and put some example payloads in the repo. If we ever get support for Webhooks that can have their payloads defined by GraphQL, that might be the optimal solution. Then we'd just need a way to describe the schema that gets sent to Probot. |
It appears that Lambda has a bunch of built-in event templates that you can use to test your app. It'd be cool to create some of these for GitHub webhooks.
The text was updated successfully, but these errors were encountered: