From 82ae17b19c8764ee6691f55b13258d0f59d07803 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Thu, 4 Jan 2024 18:27:24 +0100 Subject: [PATCH] Use the proper repoContentsUrl to access gitea repo and enhance the test case Signed-off-by: cmoulliard --- .../src/actions/gitea.test.ts | 5 +++++ plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.test.ts b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.test.ts index 5486b5b69f..8936c34690 100644 --- a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.test.ts +++ b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.test.ts @@ -137,6 +137,11 @@ describe('publish:gitea', () => { name: undefined, }, }); + + expect(mockContext.output).toHaveBeenCalledWith( + 'repoContentsUrl', + 'https://gitea.com/org1/repo/src/branch/main', + ); }); afterEach(() => { diff --git a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts index 76ddb189a6..b8ab703460 100644 --- a/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts +++ b/plugins/scaffolder-backend-module-gitea/src/actions/gitea.ts @@ -330,7 +330,7 @@ export function createPublishGiteaAction(options: { */ await sleep(3000); - const repoContentsUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}/+/refs/${defaultBranch}`; + const repoContentsUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}/src/branch/${defaultBranch}`; ctx.output('remoteUrl', remoteUrl); ctx.output('commitHash', commitResult?.commitHash); ctx.output('repoContentsUrl', repoContentsUrl);