Fix bug in root repo import where catalog-info.yaml.hcl file breaks import

Signed-off-by: sblausten <sam@roadie.io>
This commit is contained in:
sblausten
2024-06-05 19:02:52 +02:00
parent 828c355cf6
commit 67d0530796
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-github': patch
---
Fix bug in root repo import where catalog-info.yaml.hcl file is found by search and breaks the import
@@ -76,8 +76,13 @@ export class GithubLocationAnalyzer implements ScmLocationAnalyzer {
const { owner, name: repo } = parseGitUrl(url);
const catalogFile = catalogFilename || 'catalog-info.yaml';
const fileParts = catalogFile.split('.');
const extension =
fileParts.length > 0
? `extension:${fileParts[fileParts.length - 1]}`
: '';
const query = `filename:${catalogFile} repo:${owner}/${repo}`;
const query = `filename:${catalogFile} ${extension} repo:${owner}/${repo}`;
const integration = this.integrations.github.byUrl(url);
if (!integration) {