diff --git a/.changeset/good-papayas-dress.md b/.changeset/good-papayas-dress.md new file mode 100644 index 0000000000..26062c8da8 --- /dev/null +++ b/.changeset/good-papayas-dress.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': minor +--- + +Added `projectId` for gitlab projects to be displayed in the `gitlab:publish` output diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts index 27261ecd49..dc1d26d416 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts @@ -313,11 +313,12 @@ describe('publish:gitlab', () => { }); }); - it('should call output with the remoteUrl and repoContentsUrl', async () => { + it('should call output with the remoteUrl and repoContentsUrl and projectId', async () => { mockGitlabClient.Users.current.mockResolvedValue({ id: 12345 }); mockGitlabClient.Namespaces.show.mockResolvedValue({ id: 1234 }); mockGitlabClient.Projects.create.mockResolvedValue({ http_url_to_repo: 'http://mockurl.git', + id: 1234, }); await action.handler(mockContext); @@ -330,6 +331,7 @@ describe('publish:gitlab', () => { 'repoContentsUrl', 'http://mockurl/-/blob/master', ); + expect(mockContext.output).toHaveBeenCalledWith('projectId', 1234); }); it('should call the correct Gitlab APIs when setUserAsOwner option is true and integration config has a token', async () => { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts index 4fe55b77a2..9fc95b1b5e 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts @@ -112,6 +112,10 @@ export function createPublishGitlabAction(options: { title: 'A URL to the root of the repository', type: 'string', }, + projectId: { + title: 'The ID of the project', + type: 'string', + }, }, }, }, @@ -214,6 +218,7 @@ export function createPublishGitlabAction(options: { ctx.output('remoteUrl', remoteUrl); ctx.output('repoContentsUrl', repoContentsUrl); + ctx.output('projectId', projectId); }, }); }