Showing Files commited
Closed this issue · 1 comments
adahox commented
hey, i'm want show the files included on commit. but i dont find the function to do it.
tan-tan-kanarek commented
Use this example:
require_once(__DIR__ . '/client/GitHubClient.php');
$owner = 'tan-tan-kanarek';
$repos = array(
'github-php-client',
);
$client = new GitHubClient();
foreach($repos as $repo)
{
$client->setPage();
$client->setPageSize(4);
$commits = $client->repos->commits->listCommitsOnRepository($owner, $repo);
foreach($commits as $commit)
{
/* @var $commit GitHubCommit */
$sha = $commit->getSha();
$url = $commit->getUrl();
$message = $commit->getCommit()->getMessage();
$committerLoginName = $commit->getCommitter()->getLogin();
$authorLoginName = $commit->getAuthor()->getLogin();
echo "$sha - [$committerLoginName/$authorLoginName] $message\n";
$fullCommit = $client->repos->commits->getSingleCommit($owner, $repo, $sha);
foreach($fullCommit->getFiles() as $file)
{
/* @var $file GitHubFullCommitFiles */
echo "\t- " . $file->getFilename() . "\n";
}
}
}