コード例 #1
0
 public function updateCommitStatus($owner, $repos, $sha, $buildRef, $status, $description = "", $ciUrl = "")
 {
     $client = new GitHubClient();
     $settings = GitProviderSettings::singleton();
     if ($settings->username) {
         $client->setCredentials($settings->username, $settings->password);
     }
     $client->repos->statuses->createStatus($owner, $repos, $sha, $this->convertStatus($status), $ciUrl, $description, $buildRef);
 }
コード例 #2
0
 /**
  * Add a status to a commit
  *
  * @param string $owner
  * @param string $repos
  * @param string $sha
  * @param string $buildRef
  * @param string $status A status from the GitProvider::STATUS_XXX set of constants
  * @param string $description An optional description
  * @param string $ciUrl A URL for the full build status.
  * @return mixed
  */
 public function updateCommitStatus($owner, $repos, $sha, $buildRef, $status, $description = "", $ciUrl = "")
 {
     $statusEndPoint = new BitbucketBuildStatus();
     $settings = GitProviderSettings::singleton();
     if ($settings->username) {
         $statusEndPoint->getClient()->addListener(new BasicAuthListener($settings->username, $settings->password));
     }
     $params = [];
     if ($description != "") {
         $params["description"] = $description;
     }
     $statusEndPoint->create($owner, $repos, $sha, $buildRef, $this->convertStatus($status), $ciUrl, $params);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $providerName = $input->getArgument("provider");
     $owner = $input->getArgument("owner");
     $repos = $input->getArgument("repos");
     $sha = $input->getArgument("sha");
     $ref = $input->getArgument("ref");
     $state = $input->getArgument("state");
     $url = $input->getArgument("url");
     $description = $input->getArgument("description");
     $username = $input->getOption("username");
     $password = $input->getOption("password");
     if ($username) {
         $settings = GitProviderSettings::singleton();
         $settings->username = $username;
         $settings->password = $password;
     }
     /**
      * @var GitProvider $provider
      */
     $provider = null;
     switch ($providerName) {
         case "bitbucket":
             $provider = new BitbucketGitProvider();
             break;
         case "github":
             $provider = new GitHubGitProvider();
             break;
     }
     if ($provider != null) {
         $provider->updateCommitStatus($owner, $repos, $sha, $ref, $state, $description, $url);
     } else {
         $output->writeln("Error: The provider `{$providerName}` wasn't recognised.");
     }
 }