Adding optional string array of topics to publish gitlab action

Signed-off-by: Josh Maxwell <jmaxwell@qualtrics.com>
This commit is contained in:
Josh Maxwell
2022-10-24 22:53:49 -06:00
parent 99e65be542
commit 761a8aed66
@@ -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).