/** * This function must be implemented, it is define in the abstract class * */ function render() { include LIBRARYPHP_PATH . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'github-php-client-master' . DIRECTORY_SEPARATOR . 'client' . DIRECTORY_SEPARATOR . 'GitHubClient.php'; $client = new GitHubClient(); $client->setPage(); $issuesPerPage = 100; $par = explode('/', $_REQUEST['params']); // if (isset($par[2])) { if ($par[2] == 'next') { $client->getNextPage(); } elseif ($par[2] == 'previous') { $client->getPreviousPage(); } else { $issuesPerPage = $par[2]; } } $client->setPageSize($issuesPerPage); //Authenticate user with username and password //$this->login($client); //Authenticate user TYPE OAUTH BASIC //$client->setAuthType(GitHubClientBase::GITHUB_AUTH_TYPE_OAUTH_BASIC); //$client->setOauthKey($_SESSION['signup_data']['token']); //This does the same this as $this->login($client);, but returns a 404 not sure why because the scope is user , repo (also added public_repo, repo_deployment, notifications, gist) //$client->setDebug(true); //Authenticate user TYPE OAUTH WEBFLOW $client->setAuthType(GitHubClientBase::GITHUB_AUTH_TYPE_OAUTH_WEBFLOW); $client->setOauthToken($_SESSION['signup_data']['token']); $issues = $client->issues->listIssues(OWNER, REPO); $row_content = ""; foreach ($issues as $issue) { /* @var $issue GitHubIssue */ $comments = $client->issues->comments->listCommentsOnAnIssue(OWNER, REPO, $issue->getNumber()); $labels = $client->issues->labels->listLabelsOnAnIssue(OWNER, REPO, $issue->getNumber()); //Get all Labels for this issue $priority = ""; $client_name = ""; $category = ""; if (!empty($labels)) { foreach ($labels as $label) { if (strlen($label->getName()) > 2) { $tempArr = explode(":", $label->getName()); switch ($tempArr[0]) { case 'P': $priority = $tempArr[1]; break; case 'C': $client_name = $tempArr[1]; break; case 'Cat': $category = $tempArr[1]; break; } } } } //Get all comments for this issue $comment_text = ""; if (!empty($comments)) { foreach ($comments as $comment) { if ($comment_text != "") { '<br><br>' . ($comment_text .= $comment->getBody()); } else { $comment_text .= $comment->getBody(); } } } $assignee = ""; if (!empty($issue->getAssignee())) { $assignee = $issue->getAssignee()->getLogin(); } $row_content .= '<tr> <td>' . $client_name . '</td><td>' . $issue->getTitle() . '</td><td>' . $issue->getBody() . '</td><td>#' . $issue->getNumber() . '</td><td>' . $priority . '</td><td>' . $category . '</td><td>' . $assignee . '</td><td>' . $comment_text . '</td><td>' . $issue->getState() . '</td> </tr>'; } include MODULE_PATH . 'Issue' . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'issue.phtml'; }
public function reuploadRelease() { require_once __DIR__ . '/vendor/tan-tan-kanarek/github-php-client/client/GitHubClient.php'; $client = new GitHubClient(); $client->setDebug(true); $client->setAuthType(GitHubClient::GITHUB_AUTH_TYPE_BASIC); $client->setCredentials('daviddeutsch', trim(file_get_contents(__DIR__ . '/../github-oauth.token'))); foreach (glob(__DIR__ . '/tmp/*.zip') as $path) { $file = $path; } $release = $client->repos->releases->get('valanx', 'aec', 'latest'); $client->repos->releases->assets->upload('valanx', 'aec', $release->getId(), basename($file), 'application/zip', $file); }