From: Michael Wallner Date: Mon, 5 Oct 2015 09:08:36 +0000 (+0200) Subject: recognize org webhook ping X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9c0f96f197b1a5a95d5a5f37b273f40524e34728;p=m6w6%2Fgh-mirror recognize org webhook ping --- diff --git a/mirror.php b/mirror.php index f83eedf..3b71ef0 100644 --- a/mirror.php +++ b/mirror.php @@ -42,6 +42,10 @@ switch ($evt) { $response->setResponseCode(415); $response->setContentType($request->getHeader("Content-Type")); $response->getBody()->append($request->getBody()); + } elseif (!isset($json->repository) && $evt === "ping") { + // ping on an org webhook + $response->setResponseCode(202); + $response->getBody()->append("PONG"); } elseif (!in_array(isset($json->repository->owner->name)?$json->repository->owner->name:$json->repository->owner->login, $owners, true)) { $response->setResponseCode(403); $response->getBody()->append("Invalid owner");