public function execute(LocalPackage $package) { $message = (string) $this->messageRepository->fetch(); $pullRequest = $this->client->api('pull_request')->create($package->getUsername(), $package->getRepoName(), array('base' => 'master', 'head' => 'botrelli:' . $package->getLocalBranch(), 'title' => $this->getCommitTitle(), 'body' => $this->getCommitMessageWithPrefix($message))); $this->dispatchEvent(StepsEvents::PULL_REQUEST_MADE, PullRequestMade::createFromGithubResponse($pullRequest, $message, $package->getFolder())); return 201 === $this->client->getHttpClient()->getLastResponse()->getStatusCode(); }
public static function createFromPREvent(PullRequestMade $event) { return new self($event->getNumber(), $event->getRepositoryName(), $event->getURL(), $event->getFunnyMessage(), $event->getRepositoryURL(), $event->getStatus(), $event->getAvatarUrl()); }