From f9288ec4fa5c359e12c34b7bce2837001f32385c Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Fri, 25 Nov 2022 11:53:43 +0000 Subject: [PATCH] chore(events,catalog/github): update refresh key to match blob and tree Signed-off-by: Rogerio Angeliski --- .../src/providers/GithubEntityProvider.test.ts | 2 ++ .../src/providers/GithubEntityProvider.ts | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.test.ts b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.test.ts index fdf65c15a9..a41404ad9a 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.test.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.test.ts @@ -961,6 +961,7 @@ describe('GithubEntityProvider', () => { expect(entityProviderConnection.refresh).toHaveBeenCalledWith({ keys: [ 'url:https://github.com/test-org/test-repo/tree/main/catalog-info.yaml', + 'url:https://github.com/test-org/test-repo/blob/main/catalog-info.yaml', ], }); expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(0); @@ -1033,6 +1034,7 @@ describe('GithubEntityProvider', () => { expect(entityProviderConnection.refresh).toHaveBeenCalledWith({ keys: [ 'url:https://github.com/test-org/test-repo/tree/my-special-branch/catalog-info.yaml', + 'url:https://github.com/test-org/test-repo/blob/my-special-branch/catalog-info.yaml', ], }); expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(0); diff --git a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts index 8e9001f4cd..8816d8ee80 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubEntityProvider.ts @@ -336,9 +336,16 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber { if (modified.length > 0) { await this.connection.refresh({ - keys: modified.map( - filePath => `url:${event.repository.url}/tree/${branch}/${filePath}`, - ), + keys: [ + ...modified.map( + filePath => + `url:${event.repository.url}/tree/${branch}/${filePath}`, + ), + ...modified.map( + filePath => + `url:${event.repository.url}/blob/${branch}/${filePath}`, + ), + ], }); }