From c01518eae1dcf60281c970cdd919b5f311f4a8fd Mon Sep 17 00:00:00 2001 From: Sarai Misidjan Date: Wed, 22 Nov 2023 11:32:13 +0100 Subject: [PATCH 1/2] set the configuration --- src/Service/EnrichOrganizationService.php | 1 + src/Service/GithubApiService.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Service/EnrichOrganizationService.php b/src/Service/EnrichOrganizationService.php index 5828bf48..877d3ab0 100644 --- a/src/Service/EnrichOrganizationService.php +++ b/src/Service/EnrichOrganizationService.php @@ -128,6 +128,7 @@ public function enrichOrganization(ObjectEntity $organization): ObjectEntity foreach ($opencatalogiFiles as $item) { if (in_array($item['name'], $opencatalogiNames) === true) { + $this->githubApiService->setConfiguration($this->configuration); $organization = $this->githubApiService->handleOpencatalogiFile($organizationArray, $source, $item); break; diff --git a/src/Service/GithubApiService.php b/src/Service/GithubApiService.php index 18d714f2..c4f0dccc 100644 --- a/src/Service/GithubApiService.php +++ b/src/Service/GithubApiService.php @@ -564,18 +564,18 @@ public function handleOpencatalogiFile(array $organizationArray, Source $source, // Get the file from the usercontent or github api source. $opencatalogi = $this->getFileFromRawUserContent($opencatalogiUrl, $opencatalogiArray['git_url']); + // Find the sync with the source and organization html_url. + $organizationSync = $this->syncService->findSyncBySource($source, $organizationSchema, $organizationArray['html_url']); + // Check the sha of the sync with the url reference in the array. + if ($this->syncService->doesShaMatch($organizationSync, $urlReference) === true) { + return $organizationSync->getObject(); + } + // Check if the publiccodeYmlVersion is set otherwise this is not a valid file. if ($opencatalogi === null || $opencatalogi !== null && key_exists('publiccodeYmlVersion', $opencatalogi) === false ) { - return null; - } - - // Find the sync with the source and organization html_url. - $organizationSync = $this->syncService->findSyncBySource($source, $organizationSchema, $organizationArray['html_url']); - // Check the sha of the sync with the url reference in the array. - if ($this->syncService->doesShaMatch($organizationSync, $urlReference) === true) { return $organizationSync->getObject(); } @@ -1209,6 +1209,8 @@ public function findGithubRepositories(?array $data=[], ?array $configuration=[] continue; } + var_dump($repositoryArray['repository']['html_url']); + $repositorySync = $this->syncService->findSyncBySource($source, $repositorySchema, $repositoryArray['repository']['html_url']); if ($repositorySync->getObject() !== null) { From 89110e682f5f110b4bc7955a6a7cc6e806c1859d Mon Sep 17 00:00:00 2001 From: Sarai Misidjan Date: Wed, 22 Nov 2023 11:36:18 +0100 Subject: [PATCH 2/2] deleted var_dump --- src/Service/GithubApiService.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Service/GithubApiService.php b/src/Service/GithubApiService.php index c4f0dccc..883ebfee 100644 --- a/src/Service/GithubApiService.php +++ b/src/Service/GithubApiService.php @@ -1209,8 +1209,6 @@ public function findGithubRepositories(?array $data=[], ?array $configuration=[] continue; } - var_dump($repositoryArray['repository']['html_url']); - $repositorySync = $this->syncService->findSyncBySource($source, $repositorySchema, $repositoryArray['repository']['html_url']); if ($repositorySync->getObject() !== null) {