From 97f0a37378d9db4ede917b9bac9391be4f5e9ebe Mon Sep 17 00:00:00 2001 From: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Date: Mon, 8 Aug 2022 08:22:56 -0500 Subject: [PATCH] Support catalogPath wildcards Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> --- .changeset/tall-mugs-press.md | 5 +++++ .../src/providers/GitHubEntityProvider.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/tall-mugs-press.md diff --git a/.changeset/tall-mugs-press.md b/.changeset/tall-mugs-press.md new file mode 100644 index 0000000000..2a0053e95d --- /dev/null +++ b/.changeset/tall-mugs-press.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-github': patch +--- + +Improved support for wildcards in `catalogPath` diff --git a/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts index 43c01e8f7c..991b380112 100644 --- a/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts @@ -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}`; }