Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

GitHub - Integration #93

Open
Disane87 opened this issue Aug 26, 2016 · 0 comments
Open

GitHub - Integration #93

Disane87 opened this issue Aug 26, 2016 · 0 comments

Comments

@Disane87
Copy link

Disane87 commented Aug 26, 2016

Hey there,

because my revisions have the number of specific issue numbers, I've integrated an GitHub-API-Call to show details of the issue:

IMG

To achive this, you have to edit the template/revisons.php. The GitHub-Calls are made by the GitHub-API of Milo.

First, paste the code belw at the first in the revisions.php

<?php
// GitHub-API
use Milo\Github;
require '../api/libs/git/github-api.php';
$gitapi = new Github\Api;

$gitapi->setToken(new Milo\Github\OAuth\Token('ADD YOUR TOKEN HERE'));

?>

Extend the code at line 24, so it looks like this:

<?php foreach ($this->revisions as $revision) { ?>
                    <?php
                        $ran = $this->revision >= $revision;
                        $class = array();
                        if ($ran) {
                            $class[] = 'ran';
                        }

                        $files = $this->_getRevisionFiles($revision);
                        $issue =  $gitapi->decode($gitapi->get('/repos/[YOUR USER NAME]/[REPO NAME]/issues/'.$revision));
                        // var_dump($issue);
                    ?>

Now you can print all GitHub-Information for this issue/revision like this:

<h3 class="nomargin">
                                <a href="javascript:" class="revision-handle">#<?php echo $revision; ?></a> -
                                <span class="issue-git-user"><?php echo $issue->user->login; ?></span>:
                                <span class="issue-git-title"><?php echo $issue->title; ?></span>
                                (<a href="<?php echo $issue->url; ?>">GitHub</a>)
                            </h3>

It was only a quick and dirty integration. But it works for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants