}
/**
- * 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;
}
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")));
}
$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) {