Support catalogPath wildcards

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2022-08-08 08:22:56 -05:00
parent 5b830da1b1
commit 97f0a37378
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-github': patch
---
Improved support for wildcards in `catalogPath`
@@ -195,9 +195,9 @@ export class GitHubEntityProvider implements EntityProvider {
private createLocationUrl(repository: Repository): string {
const branch =
this.config.filters?.branch || repository.defaultBranchRef?.name || '-';
const catalogFile = this.config.catalogPath.substring(
this.config.catalogPath.lastIndexOf('/') + 1,
);
const catalogFile = this.config.catalogPath.startsWith('/')
? this.config.catalogPath.substring(1)
: this.config.catalogPath;
return `${repository.url}/blob/${branch}/${catalogFile}`;
}