preview comments

This commit is contained in:
Andras Bacsai
2023-06-13 15:01:11 +02:00
parent cafe9019c1
commit 8dbe3cfe0c
14 changed files with 157 additions and 23 deletions

View File

@@ -100,14 +100,13 @@ Route::post('/source/github/events', function () {
if (!$id || !$branch) {
return response('Nothing to do. No id or branch found.');
}
$applications = Application::where('repository_project_id', $id);
$applications = Application::where('repository_project_id', $id)->whereRelation('source', 'is_public', false);
if ($x_github_event === 'push') {
$applications = $applications->where('git_branch', $branch)->get();
}
if ($x_github_event === 'pull_request') {
$applications = $applications->where('git_branch', $base_branch)->get();
}
if ($applications->isEmpty()) {
return response('Nothing to do. No applications found.');
}