diff --git a/.changeset/orange-beans-float.md b/.changeset/orange-beans-float.md new file mode 100644 index 0000000000..7e31277890 --- /dev/null +++ b/.changeset/orange-beans-float.md @@ -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 diff --git a/plugins/catalog-backend-module-github/src/analyzers/GithubLocationAnalyzer.ts b/plugins/catalog-backend-module-github/src/analyzers/GithubLocationAnalyzer.ts index 2648b1bcdc..e3b367eb14 100644 --- a/plugins/catalog-backend-module-github/src/analyzers/GithubLocationAnalyzer.ts +++ b/plugins/catalog-backend-module-github/src/analyzers/GithubLocationAnalyzer.ts @@ -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) {