Skip to content

Commit

Permalink
Merge pull request #172 from OpenCatalogi/feature/OP-149/github-api-s…
Browse files Browse the repository at this point in the history
…earch

set github api configuration
  • Loading branch information
smisidjan authored Nov 22, 2023
2 parents c9c6bd1 + 89110e6 commit 6925cdd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Service/EnrichOrganizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/Service/GithubApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 6925cdd

Please sign in to comment.