Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/OP-83/search-pubiccode' …
Browse files Browse the repository at this point in the history
…into feature/OP-83/search-pubiccode
  • Loading branch information
Sarai Misidjan authored and Sarai Misidjan committed Oct 18, 2023
2 parents 528d807 + d2cfb40 commit effde53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Service/EnrichPubliccodeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getPubliccodeFromUrl(string $publiccodeUrl): ?array
{
// Get the path from the url to make the call.
$endpoint = \Safe\parse_url($publiccodeUrl)['path'];
$source = $this->resourceService->getSource($this->configuration['usercontentSource'], 'open-catalogi/open-catalogi-bundle');
$source = $this->resourceService->getSource($this->configuration['usercontentSource'], 'open-catalogi/open-catalogi-bundle');

try {
$response = $this->callService->call($source, $endpoint);
Expand All @@ -108,6 +108,7 @@ public function getPubliccodeFromUrl(string $publiccodeUrl): ?array
}

return $this->callService->decodeResponse($source, $response, 'text/yaml');

}//end getPubliccodeFromUrl()


Expand Down
6 changes: 3 additions & 3 deletions src/Service/GithubPubliccodeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ public function getRepositories(): ?array

// Find on publiccode.yaml.
$repositories = $this->callService->getAllResults($source, '/search/code', $queryConfig);

$this->pluginLogger->debug('Found '.count($repositories).' repositories.', ['plugin' => 'open-catalogi/open-catalogi-bundle']);

$repositoriesMapping = $this->resourceService->getMapping($this->configuration['repositoriesMapping'], 'open-catalogi/open-catalogi-bundle');
foreach ($repositories as $repository) {
// Get the ref query from the url. This way we can get the publiccode file with the raw.gitgubusercontent
$publiccodeUrlQuery = \Safe\parse_url($repository['url'])['query'];
$repository['urlReference'] = explode('ref=', $publiccodeUrlQuery)[1];
$publiccodeUrlQuery = \Safe\parse_url($repository['url'])['query'];
$repository['urlReference'] = explode('ref=', $publiccodeUrlQuery)[1];
$repository['repository']['name'] = str_replace('-', ' ', $repository['repository']['name']);

$result[] = $this->importRepository($repository, $repository['repository']['id'], $repositoriesMapping);
Expand Down

0 comments on commit effde53

Please sign in to comment.