X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI.php;h=3eea40d625defd7042bc1e3bb818348c5160d798;hb=98e8aa941a26ed0990814a2d87bf590e70fe3ce7;hp=0ae7655e1f99e9606c5659950636281bb9ddeb01;hpb=21ea66aa639b5c7bbd63d687d4445f821d1475ec;p=pharext%2Fpharext.org diff --git a/app/Github/API.php b/app/Github/API.php index 0ae7655..3eea40d 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -184,13 +184,13 @@ class API } /** - * Check if the pharext webhook is set for the repo and return it - * @param object $repo + * Check if the pharext webhook is set and return it + * @param array $hooks * @return stdClass hook */ - function checkRepoHook($repo) { - if (!empty($repo->hooks)) { - foreach ($repo->hooks as $hook) { + function checkHook($hooks) { + if (!empty($hooks)) { + foreach ($hooks as $hook) { if ($hook->name === "web" && $hook->config->url === $this->config->hook->url) { return $hook; } @@ -199,6 +199,18 @@ class API return null; } + /** + * Check if the pharext webhook is set for the repo and return it + * @param object $repo + * @return stdClass hook + */ + function checkRepoHook($repo) { + if (!empty($repo->hooks)) { + return $this->checkHook($repo->hooks); + } + return null; + } + function listHooks($repo) { return $this->queue(new API\Hooks\ListHooks($this, compact("repo"))); } @@ -252,7 +264,7 @@ class API $repo->name, $config ?: (array) $this->checkRepoHook($repo)->config ); - $name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name); + $name = $phar->build(); $url = uri_template($release->upload_url, compact("name")); $promise = $this->createReleaseAsset($url, $phar, "application/phar"); if ($release->draft) {