refactor(deployment): add validation for pull request existence in deployment process to enhance error handling
This commit is contained in:
@@ -225,6 +225,14 @@ class DeployController extends Controller
|
|||||||
foreach ($uuids as $uuid) {
|
foreach ($uuids as $uuid) {
|
||||||
$resource = getResourceByUuid($uuid, $teamId);
|
$resource = getResourceByUuid($uuid, $teamId);
|
||||||
if ($resource) {
|
if ($resource) {
|
||||||
|
if ($pr !== 0) {
|
||||||
|
$preview = $resource->previews()->where('pull_request_id', $pr)->first();
|
||||||
|
if (! $preview) {
|
||||||
|
$deployments->push(['message' => "Pull request {$pr} not found for this resource.", 'resource_uuid' => $uuid]);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force, $pr);
|
['message' => $return_message, 'deployment_uuid' => $deployment_uuid] = $this->deploy_resource($resource, $force, $pr);
|
||||||
if ($deployment_uuid) {
|
if ($deployment_uuid) {
|
||||||
$deployments->push(['message' => $return_message, 'resource_uuid' => $uuid, 'deployment_uuid' => $deployment_uuid->toString()]);
|
$deployments->push(['message' => $return_message, 'resource_uuid' => $uuid, 'deployment_uuid' => $deployment_uuid->toString()]);
|
||||||
|
Reference in New Issue
Block a user