Example #1
0
 public function init()
 {
     parent::init();
     $this->api = new Client();
     if ($this->enterpriseUrl) {
         $this->api->setEnterpriseUrl($this->enterpriseUrl);
     }
     $this->api->authenticate($this->authKey, null, Client::AUTH_URL_TOKEN);
     //$this->repoInfo = $this->api->repository()->show($this->owner, $this->repository);
 }
Example #2
0
 /**
  * Sends changes to git.
  * @return bool
  * @throws \Github\Exception\MissingArgumentException
  */
 public function saveGit()
 {
     $client = new Client();
     if ($this->enterpriseUrl) {
         $client->setEnterpriseUrl($this->enterpriseUrl);
     }
     $client->authenticate($this->authKey, null, Client::AUTH_URL_TOKEN);
     /**
      * @var Repo $api
      */
     $api = $client->api('repos');
     $remoteInfo = $api->contents()->show($this->owner, $this->repository, $this->remotePath);
     $api->contents()->update($this->owner, $this->repository, $this->remotePath, $this->content, $this->comment, $remoteInfo['sha']);
     return true;
 }