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