Exemple #1
0
 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"
             }
         }
     '));
 }
Exemple #2
0
        \App::abort(404);
    }
});
Route::get('contact', function () {
    return \view('apigenci.contact');
});
Route::get('logout', function () {
    \Session::flush();
    return \Redirect::away('/');
});
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();