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 9fc95b1b5e..376667fffc 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts @@ -44,6 +44,7 @@ export function createPublishGitlabAction(options: { gitAuthorName?: string; gitAuthorEmail?: string; setUserAsOwner?: boolean; + topics?: string[]; }>({ id: 'publish:gitlab', description: @@ -99,6 +100,14 @@ export function createPublishGitlabAction(options: { description: 'Set the token user as owner of the newly created repository. Requires a token authorized to do the edit in the integration configuration for the matching host', }, + topics: { + title: 'Topic labels', + description: 'Topic labels to apply on the repository.', + type: 'array', + items: { + type: 'string', + }, + }, }, }, output: { @@ -128,6 +137,7 @@ export function createPublishGitlabAction(options: { gitAuthorName, gitAuthorEmail, setUserAsOwner = false, + topics = [], } = ctx.input; const { owner, repo, host } = parseRepoUrl(repoUrl, integrations); @@ -175,6 +185,8 @@ export function createPublishGitlabAction(options: { visibility: repoVisibility, }); + await client.Projects.edit(projectId, {topics}); + // When setUserAsOwner is true the input token is expected to come from an unprivileged user GitLab // OAuth flow. In this case GitLab works in a way that allows the unprivileged user to // create the repository, but not to push the default protected branch (e.g. master).