-
Notifications
You must be signed in to change notification settings - Fork 79
feat: add new verifyAndParse()
method
#1157
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
base: main
Are you sure you want to change the base?
Conversation
This method is almost identical to `verifyAndReceive()`, the difference being that this function won't trigger the event handler, so it can be executed at a later time. Fixes #379
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
wow blast from the past! I'd forgotten about this, which hopefully shows we've all done good work in our code since I do still have lambdas consuming GH events that I've obviously not had to think about in 5 years 😄 I'm not sure though how useful this actually is especially as it doesn't seem like there's been a lot of request for it (but I could easily be wrong there) - looking at my code, I think this would be replacing this custom function: export const getEvent = async (event: ApiEvent): Promise<GithubEvent> => {
const rawBody = event.body ?? '{}';
const signature = event.headers['X-Hub-Signature-256'] ?? '';
const name = event.headers['X-GitHub-Event'];
const { GH_WEBHOOK_SECRET } = process.env;
if ((await verify(GH_WEBHOOK_SECRET, rawBody, signature)) && name) {
const payload = JSON.parse(rawBody) as GithubEvent['payload'];
return { name, payload } as GithubEvent;
}
throw new Error('event did not come from github');
}; which is pretty small and contained whereas this addition is twice the size - having said that, I'm pretty sure we could easily have |
This method is almost identical to
verifyAndReceive()
, the difference being that this function won't trigger the event handler, so it can be executed at a later time.Fixes #379
Resolves #ISSUE_NUMBER
Before the change?
EmitterWebhookEvent
object, the included functions would fire the event handler for webhook eventsAfter the change?
EmitterWebhookEvent
object without the event handler being utilised. This is especially useful for serverless platformsPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!