Skip to content

Commit

Permalink
Debug webhook failure
Browse files Browse the repository at this point in the history
  • Loading branch information
elibarzilay committed Jul 7, 2021
1 parent 9e931d1 commit 1d39a68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pr-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IgnoredBecause {
export async function httpTrigger(context: Context, req: HttpRequest) {
const isDev = process.env.AZURE_FUNCTIONS_ENVIRONMENT === "Development";
const secret = process.env.GITHUB_WEBHOOK_SECRET;
const { headers, body } = req, githubId = headers["x-github-delivery"];
const { headers, body, rawBody } = req, githubId = headers["x-github-delivery"];
const evName = headers["x-github-event"], evAction = body.action;

context.log(`>>> HTTP Trigger [${
Expand All @@ -52,7 +52,7 @@ export async function httpTrigger(context: Context, req: HttpRequest) {

// For process.env.GITHUB_WEBHOOK_SECRET see
// https://ms.portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBlade/id/%2Fsubscriptions%2F57bfeeed-c34a-4ffd-a06b-ccff27ac91b8%2FresourceGroups%2Fdtmergebot%2Fproviders%2FMicrosoft.Web%2Fsites%2FDTMergeBot
if (!isDev && !(await verify(secret!, body, headers["x-hub-signature-256"]!)))
if (!isDev && !(await verify(secret!, rawBody, headers["x-hub-signature-256"]!)))
return reply(context, 500, "This webhook did not come from GitHub");

if (evName === "check_run" && evAction === "completed") {
Expand Down

0 comments on commit 1d39a68

Please sign in to comment.