tan-tan-kanarek / github-php-client

MIT License
184 stars 120 forks source link

Get comment of commit #60

Closed nfelly closed 9 years ago

nfelly commented 9 years ago

Hello!

Just wondering if there is anyway to get the comment left when someone commits? Something like: $commit->getComment();

Thanks

tan-tan-kanarek commented 9 years ago

You can iterate the commits using:

$commits = $client->repos->commits->listCommitsOnRepository($owner, $repo);
foreach($commits as $commit)
{
    /* @var $commit GitHubCommit */
    $message = $commit->getCommit()->getMessage();
}

Or you can get directly the commit you need using:

$commit = $client->repos->commits->getSingleCommit($owner, $repo, $sha);
$message = $commit->getCommit()->getMessage();
nfelly commented 9 years ago

That's awesome! Thank you very much.