How to use the @octokit/webhooks/verify function in @octokit/webhooks

To help you get started, we’ve selected a few @octokit/webhooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github curioswitch / curiostack / tools / cloudbuild-github / src / webhook.js View on Github external
export async function handleWebhook(req: any, res: any) {
  if (
    !verify(
      await keyManager.getWebhookSecret(),
      req.rawBody.toString(),
      req.get('X-Hub-Signature'),
    )
  ) {
    console.error('Invalid signature.');
    res.status(400).end();
    return;
  }

  const event = req.body;
  const eventType = req.get('X-GitHub-Event');
  switch (eventType) {
    case 'pull_request':
      await handlePullRequest(event);
      break;

@octokit/webhooks

GitHub webhook events toolset for Node.js

MIT
Latest version published 4 months ago

Package Health Score

86 / 100
Full package analysis

Popular @octokit/webhooks functions

Similar packages