X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI.php;h=1c9ff7834e772a92cc8fb758bb8701bfaae6bf88;hb=36cfa28cf2dcee3422f0231f91c6692eb28e7824;hp=d6990f257edf7fc80fa8c04961e4687d35df251d;hpb=77b6c7f9f75740e15d745d34e7263111a73391a8;p=pharext%2Fpharext.org diff --git a/app/Github/API.php b/app/Github/API.php index d6990f2..1c9ff78 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -168,6 +168,22 @@ class API return $call($callback); } + /** + * Check if the pharext webhook is set for the repo and return it + * @param object $repo + * @return stdClass hook + */ + function checkRepoHook($repo) { + if ($repo->hooks) { + foreach ($repo->hooks as $hook) { + if ($hook->name === "web" && $hook->config->url === $this->config->hook->url) { + return $hook; + } + } + } + return null; + } + function listHooks($repo, callable $callback) { $call = new API\Hooks\ListHooks($this, compact("repo")); return $call($callback);