2015-02-06 09:22:45 -08:00

22 lines
694 B
PHP

<?php
class Cockpit_Github extends Cana_Model {
public static function commits($user, $repo, $branch = 'master') {
return c::github()->api('repo')->commits()->all($user, $repo, ['sha' => $branch]);
}
public static function createTag($user, $repo, $tag, $sha = '', $body = '') {
return true;
return c::github()->api('repo')->releases()->create($user, $repo, [
'tag_name' => $tag,
'target_commitish' => $sha,
'body' => $body
]);
}
public static function tags($user, $repo) {
$response = c::github()->getHttpClient()->get('repos/'.$user.'/'.$repo.'/git/refs/tags');
$tags = Github\HttpClient\Message\ResponseMediator::getContent($response);
return $tags;
}
}