From 0ed2723f001f391a1216cd517b1050aaf6c24eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 9 Jun 2023 13:34:46 +0200 Subject: [PATCH] Fix failing pushes --- app/controllers/api/vcs.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index abf97d7710..e8fdd91d43 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -289,12 +289,14 @@ $createGitDeployments = function (GitHub $github, string $installationId, array $dbForProject = $getProjectDB($project); $functionId = $resource->getAttribute('resourceId'); + $function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId)); + $deploymentId = ID::unique(); $vcsRepoId = $resource->getId(); $vcsRepoInternalId = $resource->getInternalId(); $vcsInstallationId = $resource->getAttribute('vcsInstallationId'); $vcsInstallationInternalId = $resource->getAttribute('vcsInstallationInternalId'); - $productionBranch = $resource->getAttribute('branch', 'main'); + $productionBranch = $function->getAttribute('vcsBranch'); $activate = false; if ($branchName == $productionBranch) { @@ -303,7 +305,7 @@ $createGitDeployments = function (GitHub $github, string $installationId, array $latestDeployment = Authorization::skip(fn () => $dbForProject->findOne('deployments', [ Query::equal('vcsRepositoryId', [$vcsRepoId]), - Query::equal('branch', [$branchName]), + Query::equal('vcsBranch', [$branchName]), Query::equal('resourceType', ['functions']), Query::orderDesc('$createdAt'), ])); @@ -324,8 +326,6 @@ $createGitDeployments = function (GitHub $github, string $installationId, array } } - $function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId)); - $deployment = $dbForProject->createDocument('deployments', new Document([ '$id' => $deploymentId, '$permissions' => [