コード例 #1
0
ファイル: Github.php プロジェクト: apigen-ci/apigen-ci
 public static function webhookRegister($id)
 {
     $repo = \Apigenci\Model::githubRepo($id)->name;
     $user = \Apigenci\Model::githubLogin();
     $json = \Apigenci\Model\Github::apiPost("repos/{$user}/{$repo}/hooks", trim('
         {
             "name": "web",
             "active": true,
             "events": [
               "push"
             ],
             "config": {
               "url": "https://apigen.ci/webhook",
               "content_type": "json",
               "insecure_ssl": "0"
             }
         }
     '));
 }
コード例 #2
0
ファイル: routes.php プロジェクト: apigen-ci/apigen-ci
Route::get('login', function () {
    return \Redirect::away(\Apigenci\Model::githubApiLoginUrl());
});
Route::post('repo/{id}/enable', function ($id) {
    $id = \Apigenci\Model::repoDecodeWeb($id);
    $data = ['id' => $id, 'repo' => \Apigenci\Model::githubRepo($id)->name, 'queued' => 0, 'enabled' => 1, 'user_id' => \Apigenci\Model::githubId()];
    \Eloquent::unguard();
    try {
        \Apigenci\Model\Repo::insert($data);
    } catch (\exception $ex) {
        // Prevent updating the PK
        unset($data['id']);
        \Apigenci\Model\Repo::find($id)->update($data);
    }
    \Apigenci\Model\Repo::queueBuild($id);
    \Apigenci\Model\Github::webhookRegister($id);
});
Route::post('repo/{id}/disable', function ($id) {
    $id = \Apigenci\Model::repoDecodeWeb($id);
    $repo = \Apigenci\Model\Repo::find($id);
    \Eloquent::unguard();
    $repo->update(['enabled' => 0, 'queued' => 0, 'failed' => 0, 'built' => 0]);
    \Queue::pushOn('low', new \App\Jobs\Apigenci\DeleteGeneratedHtml($repo));
});
Route::get('github/{owner}/{repo}', function ($owner, $repo) {
    return view('apigenci.github.invite', ['owner' => $owner, 'repo' => $repo]);
});
Route::get('github/{owner}/{repo}/tag/{tag}', function ($owner, $repo, $tag) {
    // Make sure repo exists, redirect to invite if not
    if (!\Apigenci\Model::localRepoExists($owner, $repo)) {
        return \Redirect::away("/github/{$owner}/{$repo}");