fix: no action in webhooks
This commit is contained in:
@@ -7,7 +7,7 @@ return [
|
|||||||
|
|
||||||
// The release version of your application
|
// The release version of your application
|
||||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
||||||
'release' => '4.0.0-beta.163',
|
'release' => '4.0.0-beta.164',
|
||||||
// When left empty or `null` the Laravel environment will be used
|
// When left empty or `null` the Laravel environment will be used
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.163';
|
return '4.0.0-beta.164';
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ Route::post('/source/gitlab/events/manual', function () {
|
|||||||
try {
|
try {
|
||||||
$payload = request()->collect();
|
$payload = request()->collect();
|
||||||
$headers = request()->headers->all();
|
$headers = request()->headers->all();
|
||||||
ray($payload, $headers);
|
|
||||||
$x_gitlab_token = data_get($headers, 'x-gitlab-token.0');
|
$x_gitlab_token = data_get($headers, 'x-gitlab-token.0');
|
||||||
$x_gitlab_event = data_get($payload, 'object_kind');
|
$x_gitlab_event = data_get($payload, 'object_kind');
|
||||||
if ($x_gitlab_event === 'push') {
|
if ($x_gitlab_event === 'push') {
|
||||||
@@ -83,7 +82,6 @@ Route::post('/source/gitlab/events/manual', function () {
|
|||||||
}
|
}
|
||||||
if ($x_gitlab_event === 'merge_request') {
|
if ($x_gitlab_event === 'merge_request') {
|
||||||
$action = data_get($payload, 'object_attributes.action');
|
$action = data_get($payload, 'object_attributes.action');
|
||||||
ray($action);
|
|
||||||
$branch = data_get($payload, 'object_attributes.source_branch');
|
$branch = data_get($payload, 'object_attributes.source_branch');
|
||||||
$base_branch = data_get($payload, 'object_attributes.target_branch');
|
$base_branch = data_get($payload, 'object_attributes.target_branch');
|
||||||
$full_name = data_get($payload, 'project.path_with_namespace');
|
$full_name = data_get($payload, 'project.path_with_namespace');
|
||||||
@@ -159,8 +157,7 @@ Route::post('/source/gitlab/events/manual', function () {
|
|||||||
ray('Preview deployments disabled for ' . $application->name);
|
ray('Preview deployments disabled for ' . $application->name);
|
||||||
return response('Nothing to do. Preview Deployments disabled.');
|
return response('Nothing to do. Preview Deployments disabled.');
|
||||||
}
|
}
|
||||||
}
|
} else if ($action === 'closed') {
|
||||||
if ($action === 'closed') {
|
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$found->delete();
|
$found->delete();
|
||||||
@@ -170,6 +167,8 @@ Route::post('/source/gitlab/events/manual', function () {
|
|||||||
return response('Preview Deployment closed.');
|
return response('Preview Deployment closed.');
|
||||||
}
|
}
|
||||||
return response('Nothing to do. No Preview Deployment found');
|
return response('Nothing to do. No Preview Deployment found');
|
||||||
|
} else {
|
||||||
|
return response('No action found. Contact us for debugging.', 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "3.12.36"
|
"version": "3.12.36"
|
||||||
},
|
},
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.163"
|
"version": "4.0.0-beta.164"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user