@backstage/plugin-scaffolder-backend-module-gitlab 0.9.4-next.0 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/actions/gitlab.cjs.js.map +1 -1
  3. package/dist/actions/gitlab.examples.cjs.js.map +1 -1
  4. package/dist/actions/gitlabGroupEnsureExists.cjs.js.map +1 -1
  5. package/dist/actions/gitlabGroupEnsureExists.examples.cjs.js.map +1 -1
  6. package/dist/actions/gitlabIssueCreate.cjs.js.map +1 -1
  7. package/dist/actions/gitlabIssueCreate.examples.cjs.js.map +1 -1
  8. package/dist/actions/gitlabIssueEdit.cjs.js.map +1 -1
  9. package/dist/actions/gitlabIssueEdit.examples.cjs.js.map +1 -1
  10. package/dist/actions/gitlabMergeRequest.cjs.js.map +1 -1
  11. package/dist/actions/gitlabMergeRequest.examples.cjs.js.map +1 -1
  12. package/dist/actions/gitlabPipelineTrigger.cjs.js.map +1 -1
  13. package/dist/actions/gitlabPipelineTrigger.examples.cjs.js.map +1 -1
  14. package/dist/actions/gitlabProjectAccessTokenCreate.cjs.js.map +1 -1
  15. package/dist/actions/gitlabProjectAccessTokenCreate.examples.cjs.js.map +1 -1
  16. package/dist/actions/gitlabProjectDeployTokenCreate.cjs.js.map +1 -1
  17. package/dist/actions/gitlabProjectDeployTokenCreate.examples.cjs.js.map +1 -1
  18. package/dist/actions/gitlabProjectMigrate.cjs.js.map +1 -1
  19. package/dist/actions/gitlabProjectVariableCreate.cjs.js.map +1 -1
  20. package/dist/actions/gitlabProjectVariableCreate.examples.cjs.js.map +1 -1
  21. package/dist/actions/gitlabRepoPush.cjs.js.map +1 -1
  22. package/dist/actions/gitlabRepoPush.examples.cjs.js.map +1 -1
  23. package/dist/actions/helpers.cjs.js +5 -0
  24. package/dist/actions/helpers.cjs.js.map +1 -1
  25. package/dist/autocomplete/autocomplete.cjs.js.map +1 -1
  26. package/dist/commonGitlabConfig.cjs.js.map +1 -1
  27. package/dist/module.cjs.js.map +1 -1
  28. package/dist/util.cjs.js.map +1 -1
  29. package/package.json +10 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.9.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5bb870b: Show additional information about the cause in error messages from GitLab
8
+ - df2bfab: The `description` property in `publish:gitlab:merge-request` has been made optional again to comply with the GitLab API.
9
+ - Updated dependencies
10
+ - @backstage/plugin-scaffolder-node@0.11.0
11
+ - @backstage/backend-plugin-api@1.4.2
12
+
13
+ ## 0.9.4-next.1
14
+
15
+ ### Patch Changes
16
+
17
+ - 5bb870b: Show additional information about the cause in error messages from GitLab
18
+
3
19
  ## 0.9.4-next.0
4
20
 
5
21
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.cjs.js","sources":["../../src/actions/gitlab.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { Gitlab, VariableType } from '@gitbeaker/rest';\nimport { Config } from '@backstage/config';\nimport { examples } from './gitlab.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitLab.\n *\n * @public\n */\nexport function createPublishGitlabAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gitlab',\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to GitLab.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n repoVisibility: z =>\n z\n .enum(['private', 'public', 'internal'], {\n description: `Sets the visibility of the repository. The default value is 'private'. (deprecated, use settings.visibility instead)`,\n })\n .optional(),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n sourcePath: z =>\n z\n .union([z.string(), z.boolean()], {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted or set to true, the entire workspace will be published as the repository. If set to false, the created repository will be empty.',\n })\n .optional(),\n skipExisting: z =>\n z\n .boolean({\n description:\n 'Do not publish the repository if it already exists. The default value is false.',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n setUserAsOwner: z =>\n z\n .boolean({\n description:\n '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',\n })\n .optional(),\n topics: z =>\n z\n .array(z.string(), {\n description:\n 'Topic labels to apply on the repository. (deprecated, use settings.topics instead)',\n })\n .optional(),\n settings: z =>\n z\n .object({\n path: z\n .string({\n description:\n 'Repository name for new project. Generated based on name if not provided (generated as lowercase with dashes).',\n })\n .optional(),\n auto_devops_enabled: z\n .boolean({\n description: 'Enable Auto DevOps for this project',\n })\n .optional(),\n ci_config_path: z\n .string({\n description: 'Custom CI config path for this project',\n })\n .optional(),\n description: z\n .string({\n description: 'Short project description',\n })\n .optional(),\n merge_method: z\n .enum(['merge', 'rebase_merge', 'ff'], {\n description: 'Merge Methods (merge, rebase_merge, ff)',\n })\n .optional(),\n squash_option: z\n .enum(['default_off', 'default_on', 'never', 'always'], {\n description:\n 'Set squash option for the project (never, always, default_on, default_off)',\n })\n .optional(),\n topics: z\n .array(z.string(), {\n description: 'Topic labels to apply on the repository',\n })\n .optional(),\n visibility: z\n .enum(['private', 'public', 'internal'], {\n description:\n 'The visibility of the project. Can be private, internal, or public. The default value is private.',\n })\n .optional(),\n only_allow_merge_if_all_discussions_are_resolved: z\n .boolean({\n description:\n 'Set whether merge requests can only be merged when all the discussions are resolved.',\n })\n .optional(),\n only_allow_merge_if_pipeline_succeeds: z\n .boolean({\n description:\n 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.',\n })\n .optional(),\n allow_merge_on_skipped_pipeline: z\n .boolean({\n description:\n 'Set whether or not merge requests can be merged with skipped jobs.',\n })\n .optional(),\n })\n .optional(),\n branches: z =>\n z\n .array(\n z.object({\n name: z.string(),\n protect: z.boolean().optional(),\n create: z.boolean().optional(),\n ref: z.string().optional(),\n }),\n )\n .optional(),\n projectVariables: z =>\n z\n .array(\n z.object({\n key: z.string(),\n value: z.string(),\n description: z.string().optional(),\n variable_type: z.enum(['env_var', 'file']).optional(),\n protected: z.boolean().optional(),\n masked: z.boolean().optional(),\n raw: z.boolean().optional(),\n environment_scope: z.string().optional(),\n }),\n )\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z.string({\n description: 'A URL to the repository with the provider',\n }),\n repoContentsUrl: z =>\n z.string({\n description: 'A URL to the root of the repository',\n }),\n projectId: z =>\n z.number({\n description: 'The ID of the project',\n }),\n commitHash: z =>\n z.string({\n description: 'The git commit hash of the initial commit',\n }),\n created: z =>\n z.boolean({\n description: 'Whether the repository was created or not',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n repoVisibility = 'private',\n defaultBranch = 'master',\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n setUserAsOwner = false,\n topics = [],\n settings = {},\n branches = [],\n projectVariables = [],\n skipExisting = false,\n signCommit,\n } = ctx.input;\n const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(\n `No owner provided for host: ${host}, and repo ${repo}`,\n );\n }\n\n const integrationConfig = integrations.gitlab.byHost(host);\n\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n if (!integrationConfig.config.token && !ctx.input.token) {\n throw new InputError(`No token available for host ${host}`);\n }\n\n const token = ctx.input.token || integrationConfig.config.token!;\n const tokenType = ctx.input.token ? 'oauthToken' : 'token';\n\n const client = new Gitlab({\n host: integrationConfig.config.baseUrl,\n [tokenType]: token,\n });\n\n let targetNamespaceId;\n let targetNamespaceKind;\n try {\n const namespaceResponse = (await client.Namespaces.show(owner)) as {\n id: number;\n kind: string;\n };\n\n targetNamespaceId = namespaceResponse.id;\n targetNamespaceKind = namespaceResponse.kind;\n } catch (e) {\n if (e.cause?.response?.status === 404) {\n throw new InputError(\n `The namespace ${owner} is not found or the user doesn't have permissions to access it`,\n );\n }\n throw e;\n }\n\n const { id: userId } = (await client.Users.showCurrentUser()) as {\n id: number;\n };\n\n if (!targetNamespaceId) {\n targetNamespaceId = userId;\n targetNamespaceKind = 'user';\n }\n\n const existingProjects =\n targetNamespaceKind === 'user'\n ? await client.Users.allProjects(owner, { search: repo })\n : await client.Groups.allProjects(owner, { search: repo });\n\n const existingProject = existingProjects.find(\n project => project.path === repo,\n );\n\n if (!skipExisting || (skipExisting && !existingProject)) {\n ctx.logger.info(`Creating repo ${repo} in namespace ${owner}.`);\n const { id: projectId, http_url_to_repo } =\n await client.Projects.create({\n namespaceId: targetNamespaceId,\n name: repo,\n visibility: repoVisibility,\n ...(topics.length ? { topics } : {}),\n ...(Object.keys(settings).length ? { ...settings } : {}),\n });\n\n // When setUserAsOwner is true the input token is expected to come from an unprivileged user GitLab\n // OAuth flow. In this case GitLab works in a way that allows the unprivileged user to\n // create the repository, but not to push the default protected branch (e.g. master).\n // In order to set the user as owner of the newly created repository we need to check that the\n // GitLab integration configuration for the matching host contains a token and use\n // such token to bootstrap a new privileged client.\n if (setUserAsOwner && integrationConfig.config.token) {\n const adminClient = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: integrationConfig.config.token,\n });\n\n await adminClient.ProjectMembers.add(projectId, userId, 50);\n }\n\n const remoteUrl = (http_url_to_repo as string).replace(/\\.git$/, '');\n const repoContentsUrl = `${remoteUrl}/-/blob/${defaultBranch}`;\n\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const shouldSkipPublish =\n typeof ctx.input.sourcePath === 'boolean' && !ctx.input.sourcePath;\n if (!shouldSkipPublish) {\n const commitResult = await initRepoAndPush({\n dir:\n typeof ctx.input.sourcePath === 'boolean'\n ? ctx.workspacePath\n : getRepoSourceDirectory(\n ctx.workspacePath,\n ctx.input.sourcePath,\n ),\n remoteUrl: http_url_to_repo as string,\n defaultBranch,\n auth: {\n username: 'oauth2',\n password: token,\n },\n logger: ctx.logger,\n commitMessage: gitCommitMessage\n ? gitCommitMessage\n : config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n if (branches) {\n for (const branch of branches) {\n const {\n name,\n protect = false,\n create = false,\n ref = 'master',\n } = branch;\n\n if (create) {\n try {\n await client.Branches.create(projectId, name, ref);\n } catch (e) {\n throw new InputError(\n `Branch creation failed for ${name}. ${printGitlabError(\n e,\n )}`,\n );\n }\n ctx.logger.info(\n `Branch ${name} created for ${projectId} with ref ${ref}`,\n );\n }\n\n if (protect) {\n try {\n await client.ProtectedBranches.protect(projectId, name);\n } catch (e) {\n throw new InputError(\n `Branch protection failed for ${name}. ${printGitlabError(\n e,\n )}`,\n );\n }\n ctx.logger.info(`Branch ${name} protected for ${projectId}`);\n }\n }\n }\n ctx.output('commitHash', commitResult?.commitHash);\n }\n\n if (projectVariables) {\n for (const variable of projectVariables) {\n const variableWithDefaults = Object.assign(variable, {\n variable_type: (variable.variable_type ??\n 'env_var') as VariableType,\n protected: variable.protected ?? false,\n masked: variable.masked ?? false,\n raw: variable.raw ?? false,\n environment_scope: variable.environment_scope ?? '*',\n });\n\n try {\n await client.ProjectVariables.create(\n projectId,\n variableWithDefaults.key,\n variableWithDefaults.value,\n {\n variableType: variableWithDefaults.variable_type,\n protected: variableWithDefaults.protected,\n masked: variableWithDefaults.masked,\n environmentScope: variableWithDefaults.environment_scope,\n description: variableWithDefaults.description,\n raw: variableWithDefaults.raw,\n },\n );\n } catch (e) {\n throw new InputError(\n `Environment variable creation failed for ${\n variableWithDefaults.key\n }. ${printGitlabError(e)}`,\n );\n }\n }\n }\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('projectId', projectId);\n ctx.output('created', true);\n } else if (existingProject) {\n ctx.logger.info(`Repo ${repo} already exists in namespace ${owner}.`);\n const {\n id: projectId,\n http_url_to_repo,\n default_branch,\n } = existingProject;\n const remoteUrl = (http_url_to_repo as string).replace(/\\.git$/, '');\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', `${remoteUrl}/-/blob/${default_branch}`);\n ctx.output('projectId', projectId);\n ctx.output('created', false);\n }\n },\n });\n}\n\nfunction printGitlabError(error: any): string {\n return JSON.stringify({ code: error.code, message: error.description });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","Gitlab","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;AAkCO,SAAS,0BAA0B,OAGvC,EAAA;AACD,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,OAAA;AAEjC,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,gBAAA;AAAA,IACJ,WACE,EAAA,2FAAA;AAAA,cACFC,wBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,cAAA,EAAgB,OACd,CACG,CAAA,IAAA,CAAK,CAAC,SAAW,EAAA,QAAA,EAAU,UAAU,CAAG,EAAA;AAAA,UACvC,WAAa,EAAA,CAAA,oHAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,aAAA,EAAe,CACb,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA,CAAA,wEAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,gBAAA,EAAkB,CAChB,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA,CAAA,gFAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,aAAA,EAAe,CACb,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA,CAAA,8EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,cAAA,EAAgB,CACd,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA,CAAA,6CAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,UAAA,EAAY,CACV,CAAA,KAAA,CAAA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AAiB,KAAoB,EAAA;AAC5C,EAAO,OAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAM,MAAM,IAAM,EAAA,OAAA,EAAS,KAAM,CAAA,WAAA,EAAa,CAAA;AACxE;;;;"}
1
+ {"version":3,"file":"gitlab.cjs.js","sources":["../../src/actions/gitlab.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { Gitlab, VariableType } from '@gitbeaker/rest';\nimport { Config } from '@backstage/config';\nimport { examples } from './gitlab.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitLab.\n *\n * @public\n */\nexport function createPublishGitlabAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gitlab',\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to GitLab.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n repoVisibility: z =>\n z\n .enum(['private', 'public', 'internal'], {\n description: `Sets the visibility of the repository. The default value is 'private'. (deprecated, use settings.visibility instead)`,\n })\n .optional(),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n sourcePath: z =>\n z\n .union([z.string(), z.boolean()], {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted or set to true, the entire workspace will be published as the repository. If set to false, the created repository will be empty.',\n })\n .optional(),\n skipExisting: z =>\n z\n .boolean({\n description:\n 'Do not publish the repository if it already exists. The default value is false.',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n setUserAsOwner: z =>\n z\n .boolean({\n description:\n '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',\n })\n .optional(),\n topics: z =>\n z\n .array(z.string(), {\n description:\n 'Topic labels to apply on the repository. (deprecated, use settings.topics instead)',\n })\n .optional(),\n settings: z =>\n z\n .object({\n path: z\n .string({\n description:\n 'Repository name for new project. Generated based on name if not provided (generated as lowercase with dashes).',\n })\n .optional(),\n auto_devops_enabled: z\n .boolean({\n description: 'Enable Auto DevOps for this project',\n })\n .optional(),\n ci_config_path: z\n .string({\n description: 'Custom CI config path for this project',\n })\n .optional(),\n description: z\n .string({\n description: 'Short project description',\n })\n .optional(),\n merge_method: z\n .enum(['merge', 'rebase_merge', 'ff'], {\n description: 'Merge Methods (merge, rebase_merge, ff)',\n })\n .optional(),\n squash_option: z\n .enum(['default_off', 'default_on', 'never', 'always'], {\n description:\n 'Set squash option for the project (never, always, default_on, default_off)',\n })\n .optional(),\n topics: z\n .array(z.string(), {\n description: 'Topic labels to apply on the repository',\n })\n .optional(),\n visibility: z\n .enum(['private', 'public', 'internal'], {\n description:\n 'The visibility of the project. Can be private, internal, or public. The default value is private.',\n })\n .optional(),\n only_allow_merge_if_all_discussions_are_resolved: z\n .boolean({\n description:\n 'Set whether merge requests can only be merged when all the discussions are resolved.',\n })\n .optional(),\n only_allow_merge_if_pipeline_succeeds: z\n .boolean({\n description:\n 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.',\n })\n .optional(),\n allow_merge_on_skipped_pipeline: z\n .boolean({\n description:\n 'Set whether or not merge requests can be merged with skipped jobs.',\n })\n .optional(),\n })\n .optional(),\n branches: z =>\n z\n .array(\n z.object({\n name: z.string(),\n protect: z.boolean().optional(),\n create: z.boolean().optional(),\n ref: z.string().optional(),\n }),\n )\n .optional(),\n projectVariables: z =>\n z\n .array(\n z.object({\n key: z.string(),\n value: z.string(),\n description: z.string().optional(),\n variable_type: z.enum(['env_var', 'file']).optional(),\n protected: z.boolean().optional(),\n masked: z.boolean().optional(),\n raw: z.boolean().optional(),\n environment_scope: z.string().optional(),\n }),\n )\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z.string({\n description: 'A URL to the repository with the provider',\n }),\n repoContentsUrl: z =>\n z.string({\n description: 'A URL to the root of the repository',\n }),\n projectId: z =>\n z.number({\n description: 'The ID of the project',\n }),\n commitHash: z =>\n z.string({\n description: 'The git commit hash of the initial commit',\n }),\n created: z =>\n z.boolean({\n description: 'Whether the repository was created or not',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n repoVisibility = 'private',\n defaultBranch = 'master',\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n setUserAsOwner = false,\n topics = [],\n settings = {},\n branches = [],\n projectVariables = [],\n skipExisting = false,\n signCommit,\n } = ctx.input;\n const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(\n `No owner provided for host: ${host}, and repo ${repo}`,\n );\n }\n\n const integrationConfig = integrations.gitlab.byHost(host);\n\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n if (!integrationConfig.config.token && !ctx.input.token) {\n throw new InputError(`No token available for host ${host}`);\n }\n\n const token = ctx.input.token || integrationConfig.config.token!;\n const tokenType = ctx.input.token ? 'oauthToken' : 'token';\n\n const client = new Gitlab({\n host: integrationConfig.config.baseUrl,\n [tokenType]: token,\n });\n\n let targetNamespaceId;\n let targetNamespaceKind;\n try {\n const namespaceResponse = (await client.Namespaces.show(owner)) as {\n id: number;\n kind: string;\n };\n\n targetNamespaceId = namespaceResponse.id;\n targetNamespaceKind = namespaceResponse.kind;\n } catch (e) {\n if (e.cause?.response?.status === 404) {\n throw new InputError(\n `The namespace ${owner} is not found or the user doesn't have permissions to access it`,\n );\n }\n throw e;\n }\n\n const { id: userId } = (await client.Users.showCurrentUser()) as {\n id: number;\n };\n\n if (!targetNamespaceId) {\n targetNamespaceId = userId;\n targetNamespaceKind = 'user';\n }\n\n const existingProjects =\n targetNamespaceKind === 'user'\n ? await client.Users.allProjects(owner, { search: repo })\n : await client.Groups.allProjects(owner, { search: repo });\n\n const existingProject = existingProjects.find(\n project => project.path === repo,\n );\n\n if (!skipExisting || (skipExisting && !existingProject)) {\n ctx.logger.info(`Creating repo ${repo} in namespace ${owner}.`);\n const { id: projectId, http_url_to_repo } =\n await client.Projects.create({\n namespaceId: targetNamespaceId,\n name: repo,\n visibility: repoVisibility,\n ...(topics.length ? { topics } : {}),\n ...(Object.keys(settings).length ? { ...settings } : {}),\n });\n\n // When setUserAsOwner is true the input token is expected to come from an unprivileged user GitLab\n // OAuth flow. In this case GitLab works in a way that allows the unprivileged user to\n // create the repository, but not to push the default protected branch (e.g. master).\n // In order to set the user as owner of the newly created repository we need to check that the\n // GitLab integration configuration for the matching host contains a token and use\n // such token to bootstrap a new privileged client.\n if (setUserAsOwner && integrationConfig.config.token) {\n const adminClient = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: integrationConfig.config.token,\n });\n\n await adminClient.ProjectMembers.add(projectId, userId, 50);\n }\n\n const remoteUrl = (http_url_to_repo as string).replace(/\\.git$/, '');\n const repoContentsUrl = `${remoteUrl}/-/blob/${defaultBranch}`;\n\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const shouldSkipPublish =\n typeof ctx.input.sourcePath === 'boolean' && !ctx.input.sourcePath;\n if (!shouldSkipPublish) {\n const commitResult = await initRepoAndPush({\n dir:\n typeof ctx.input.sourcePath === 'boolean'\n ? ctx.workspacePath\n : getRepoSourceDirectory(\n ctx.workspacePath,\n ctx.input.sourcePath,\n ),\n remoteUrl: http_url_to_repo as string,\n defaultBranch,\n auth: {\n username: 'oauth2',\n password: token,\n },\n logger: ctx.logger,\n commitMessage: gitCommitMessage\n ? gitCommitMessage\n : config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n if (branches) {\n for (const branch of branches) {\n const {\n name,\n protect = false,\n create = false,\n ref = 'master',\n } = branch;\n\n if (create) {\n try {\n await client.Branches.create(projectId, name, ref);\n } catch (e) {\n throw new InputError(\n `Branch creation failed for ${name}. ${printGitlabError(\n e,\n )}`,\n );\n }\n ctx.logger.info(\n `Branch ${name} created for ${projectId} with ref ${ref}`,\n );\n }\n\n if (protect) {\n try {\n await client.ProtectedBranches.protect(projectId, name);\n } catch (e) {\n throw new InputError(\n `Branch protection failed for ${name}. ${printGitlabError(\n e,\n )}`,\n );\n }\n ctx.logger.info(`Branch ${name} protected for ${projectId}`);\n }\n }\n }\n ctx.output('commitHash', commitResult?.commitHash);\n }\n\n if (projectVariables) {\n for (const variable of projectVariables) {\n const variableWithDefaults = Object.assign(variable, {\n variable_type: (variable.variable_type ??\n 'env_var') as VariableType,\n protected: variable.protected ?? false,\n masked: variable.masked ?? false,\n raw: variable.raw ?? false,\n environment_scope: variable.environment_scope ?? '*',\n });\n\n try {\n await client.ProjectVariables.create(\n projectId,\n variableWithDefaults.key,\n variableWithDefaults.value,\n {\n variableType: variableWithDefaults.variable_type,\n protected: variableWithDefaults.protected,\n masked: variableWithDefaults.masked,\n environmentScope: variableWithDefaults.environment_scope,\n description: variableWithDefaults.description,\n raw: variableWithDefaults.raw,\n },\n );\n } catch (e) {\n throw new InputError(\n `Environment variable creation failed for ${\n variableWithDefaults.key\n }. ${printGitlabError(e)}`,\n );\n }\n }\n }\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('projectId', projectId);\n ctx.output('created', true);\n } else if (existingProject) {\n ctx.logger.info(`Repo ${repo} already exists in namespace ${owner}.`);\n const {\n id: projectId,\n http_url_to_repo,\n default_branch,\n } = existingProject;\n const remoteUrl = (http_url_to_repo as string).replace(/\\.git$/, '');\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', `${remoteUrl}/-/blob/${default_branch}`);\n ctx.output('projectId', projectId);\n ctx.output('created', false);\n }\n },\n });\n}\n\nfunction printGitlabError(error: any): string {\n return JSON.stringify({ code: error.code, message: error.description });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","Gitlab","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;AAkCO,SAAS,0BAA0B,OAAA,EAGvC;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAA,EAAO,GAAI,OAAA;AAEjC,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,gBAAA;AAAA,IACJ,WAAA,EACE,2FAAA;AAAA,cACFC,wBAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA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C,CAAC,CAAA;AAAA,eAC1B;AAAA,YACF;AAAA,UACF;AAAA,QACF;AACA,QAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,QAAA,GAAA,CAAI,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAC7C,QAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,QAAA,GAAA,CAAI,MAAA,CAAO,WAAW,IAAI,CAAA;AAAA,MAC5B,WAAW,eAAA,EAAiB;AAC1B,QAAA,GAAA,CAAI,OAAO,IAAA,CAAK,CAAA,KAAA,EAAQ,IAAI,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,CAAG,CAAA;AACpE,QAAA,MAAM;AAAA,UACJ,EAAA,EAAI,SAAA;AAAA,UACJ,gBAAA;AAAA,UACA;AAAA,SACF,GAAI,eAAA;AACJ,QAAA,MAAM,SAAA,GAAa,gBAAA,CAA4B,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA;AACnE,QAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,QAAA,GAAA,CAAI,OAAO,iBAAA,EAAmB,CAAA,EAAG,SAAS,CAAA,QAAA,EAAW,cAAc,CAAA,CAAE,CAAA;AACrE,QAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,QAAA,GAAA,CAAI,MAAA,CAAO,WAAW,KAAK,CAAA;AAAA,MAC7B;AAAA,IACF;AAAA,GACD,CAAA;AACH;AAEA,SAAS,iBAAiB,KAAA,EAAoB;AAC5C,EAAA,OAAO,IAAA,CAAK,UAAU,EAAE,IAAA,EAAM,MAAM,IAAA,EAAM,OAAA,EAAS,KAAA,CAAM,WAAA,EAAa,CAAA;AACxE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.examples.cjs.js","sources":["../../src/actions/gitlab.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a git repository with the content in the workspace, and publishes it to GitLab with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n },\n },\n ],\n }),\n },\n {\n description: 'Add a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with an initial commit message, if not set defaults to `initial commit`.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n description: 'Initialize a git repository',\n gitCommitMessage: 'Started a project.',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with additional settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n ci_config_path: '.gitlab-ci.yml',\n visibility: 'public',\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with fast forward merge and always squash settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n merge_method: 'ff',\n squash_option: 'always',\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with branch settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n branches: [\n {\n name: 'dev',\n create: true,\n protect: true,\n ref: 'master',\n },\n {\n name: 'master',\n protect: true,\n },\n ],\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with environment variables.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n projectVariables: [\n {\n key: 'key1',\n value: 'value1',\n protected: true,\n masked: false,\n },\n {\n key: 'key2',\n value: 'value2',\n protected: true,\n masked: false,\n },\n ],\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with pipeline must succeed and allow merge on skipped pipeline settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n only_allow_merge_if_pipeline_succeeds: true,\n allow_merge_on_skipped_pipeline: true,\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with setting to require all threads (discussions) on merge request to be resolved before merging.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n only_allow_merge_if_all_discussions_are_resolved: true,\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with the default readme and no files from workspace only if this repository does not exist yet.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n skipExisting: true,\n initialize_with_readme: true,\n sourcePath: false,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,4HAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,gBAAA;AAAA,UACR,IAAM,EAAA,mBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,oBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,gBAAA;AAAA,UACR,IAAM,EAAA,mBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,+CAAA;AAAA,YACT,WAAa,EAAA;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,0GAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,gBAAA;AAAA,UACR,IAAM,EAAA,mBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,+CAAA;AAAA,YACT,WAAa,EAAA,6BAAA;AAAA,YACb,gBAAkB,EAAA;AAAA;AACpB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,2DAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,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AAA;AAAA,cACR,gDAAkD,EAAA;AAAA;AACpD;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,iIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,gBAAA;AAAA,UACR,IAAM,EAAA,mBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,+CAAA;AAAA,YACT,YAAc,EAAA,IAAA;AAAA,YACd,sBAAwB,EAAA,IAAA;AAAA,YACxB,UAAY,EAAA;AAAA;AACd;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlab.examples.cjs.js","sources":["../../src/actions/gitlab.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a git repository with the content in the workspace, and publishes it to GitLab with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n },\n },\n ],\n }),\n },\n {\n description: 'Add a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with an initial commit message, if not set defaults to `initial commit`.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n description: 'Initialize a git repository',\n gitCommitMessage: 'Started a project.',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with additional settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n ci_config_path: '.gitlab-ci.yml',\n visibility: 'public',\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with fast forward merge and always squash settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n merge_method: 'ff',\n squash_option: 'always',\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with branch settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n branches: [\n {\n name: 'dev',\n create: true,\n protect: true,\n ref: 'master',\n },\n {\n name: 'master',\n protect: true,\n },\n ],\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a GitLab repository with environment variables.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n projectVariables: [\n {\n key: 'key1',\n value: 'value1',\n protected: true,\n masked: false,\n },\n {\n key: 'key2',\n value: 'value2',\n protected: true,\n masked: false,\n },\n ],\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with pipeline must succeed and allow merge on skipped pipeline settings.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n only_allow_merge_if_pipeline_succeeds: true,\n allow_merge_on_skipped_pipeline: true,\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with setting to require all threads (discussions) on merge request to be resolved before merging.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n settings: {\n only_allow_merge_if_all_discussions_are_resolved: true,\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a GitLab repository with the default readme and no files from workspace only if this repository does not exist yet.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitlab',\n name: 'Publish to GitLab',\n input: {\n repoUrl: 'gitlab.com?repo=project_name&owner=group_name',\n skipExisting: true,\n initialize_with_readme: true,\n sourcePath: false,\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EACE,4HAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,gBAAA;AAAA,UACR,IAAA,EAAM,mBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,oBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,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AAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,gBAAA;AAAA,UACR,IAAA,EAAM,mBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,+CAAA;AAAA,YACT,QAAA,EAAU;AAAA,cACR,qCAAA,EAAuC,IAAA;AAAA,cACvC,+BAAA,EAAiC;AAAA;AACnC;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,mIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,gBAAA;AAAA,UACR,IAAA,EAAM,mBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,+CAAA;AAAA,YACT,QAAA,EAAU;AAAA,cACR,gDAAA,EAAkD;AAAA;AACpD;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,iIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,gBAAA;AAAA,UACR,IAAA,EAAM,mBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,+CAAA;AAAA,YACT,YAAA,EAAc,IAAA;AAAA,YACd,sBAAA,EAAwB,IAAA;AAAA,YACxB,UAAA,EAAY;AAAA;AACd;AACF;AACF,KACD;AAAA;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n path: z =>\n z\n .array(\n z.string().or(\n z.object({\n name: z.string(),\n slug: z.string(),\n }),\n ),\n {\n description:\n 'A path of group names or objects (name and slug) that is ensured to exist',\n },\n )\n .min(1),\n },\n output: {\n groupId: z =>\n z\n .number({\n description: 'The id of the innermost sub-group',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const { name, slug } of pathIterator(path)) {\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n return (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n },\n });\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n\ntype PathPart = { name: string; slug: string };\ntype PathItem = string | PathPart;\n\nfunction* pathIterator(items: PathItem[]): Generator<PathPart> {\n for (const item of items) {\n if (typeof item === 'string') {\n const parts = item.split('/');\n for (const part of parts) {\n yield { name: part, slug: part };\n }\n } else {\n yield item;\n }\n }\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","getClient"],"mappings":";;;;;;AA2Ba,MAAA,mCAAA,GAAsC,CAAC,OAE9C,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AAEzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,2BAAA;AAAA,IACJ,WAAa,EAAA,+BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CACL,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,IAAA,EAAM,OACJ,CACG,CAAA,KAAA;AAAA,UACC,CAAA,CAAE,QAAS,CAAA,EAAA;AA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,UAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,CAA0B,uBAAA,EAAA,QAAQ,CAAE,CAAA,CAAA;AAEpD,UAAW,QAAA,GAAA,MAAM,IAAI,UAAW,CAAA;AAAA,YAC9B,KAAK,CAAU,OAAA,EAAA,IAAI,CAAI,CAAA,EAAA,IAAI,IAAI,QAAQ,CAAA,CAAA;AAAA;AAAA,YAEvC,IAAI,YAAY;AACd,cACE,OAAA,CAAA,MAAM,IAAI,MAAO,CAAA,MAAA;AAAA,gBACf,IAAA;AAAA,gBACA,IAAA;AAAA,gBACA,QACI,GAAA;AAAA,kBACE;AAAA,oBAEF;AAAC,eAEN,GAAA,EAAA;AAAA;AACL,WACD,CAAA;AAAA,SACI,MAAA;AACL,UAAA,QAAA,GAAW,QAAS,CAAA,EAAA;AAAA;AAEtB,QAAc,WAAA,GAAA,QAAA;AAAA;AAEhB,MAAA,IAAI,aAAa,IAAM,EAAA;AACrB,QAAI,GAAA,CAAA,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA;AAChC;AACF,GACD,CAAA;AACH;AAKA,UAAU,aAAa,KAAwC,EAAA;AAC7D,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,MAAM,MAAA,KAAA,GAAQ,IAAK,CAAA,KAAA,CAAM,GAAG,CAAA;AAC5B,MAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,QAAA,MAAM,EAAE,IAAA,EAAM,IAAM,EAAA,IAAA,EAAM,IAAK,EAAA;AAAA;AACjC,KACK,MAAA;AACL,MAAM,MAAA,IAAA;AAAA;AACR;AAEJ;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n path: z =>\n z\n .array(\n z.string().or(\n z.object({\n name: z.string(),\n slug: z.string(),\n }),\n ),\n {\n description:\n 'A path of group names or objects (name and slug) that is ensured to exist',\n },\n )\n .min(1),\n },\n output: {\n groupId: z =>\n z\n .number({\n description: 'The id of the innermost sub-group',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const { name, slug } of pathIterator(path)) {\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n return (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n },\n });\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n\ntype PathPart = { name: string; slug: string };\ntype PathItem = string | PathPart;\n\nfunction* pathIterator(items: PathItem[]): Generator<PathPart> {\n for (const item of items) {\n if (typeof item === 'string') {\n const parts = item.split('/');\n for (const part of parts) {\n yield { name: part, slug: part };\n }\n } else {\n yield item;\n }\n }\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","getClient"],"mappings":";;;;;;AA2BO,MAAM,mCAAA,GAAsC,CAAC,OAAA,KAE9C;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AAEzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,2BAAA;AAAA,IACJ,WAAA,EAAa,+BAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,IAAA,EAAM,OACJ,CAAA,CACG,KAAA;AAAA,UACC,CAAA,CAAE,QAAO,CAAE,EAAA;AAAA,YACT,EAAE,MAAA,CAAO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AAA,CAAO,IAAA,CAAK,CAAA,uBAAA,EAA0B,QAAQ,CAAA,CAAE,CAAA;AAEpD,UAAA,QAAA,GAAW,MAAM,IAAI,UAAA,CAAW;AAAA,YAC9B,KAAK,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,IAAI,IAAI,QAAQ,CAAA,CAAA;AAAA;AAAA,YAEvC,IAAI,YAAY;AACd,cAAA,OAAA,CACE,MAAM,IAAI,MAAA,CAAO,MAAA;AAAA,gBACf,IAAA;AAAA,gBACA,IAAA;AAAA,gBACA,QAAA,GACI;AAAA,kBACE;AAAA,oBAEF;AAAC,eACP,GACC,EAAA;AAAA,YACL;AAAA,WACD,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,QAAA,GAAW,QAAA,CAAS,EAAA;AAAA,QACtB;AACA,QAAA,WAAA,GAAc,QAAA;AAAA,MAChB;AACA,MAAA,IAAI,aAAa,IAAA,EAAM;AACrB,QAAA,GAAA,CAAI,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA,MAChC;AAAA,IACF;AAAA,GACD,CAAA;AACH;AAKA,UAAU,aAAa,KAAA,EAAwC;AAC7D,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,MAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,MAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,QAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAK;AAAA,MACjC;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,IAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group using objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n { name: 'Group 1', slug: 'group1' },\n { name: 'Group 2', slug: 'group2' },\n { name: 'Group 3', slug: 'group3' },\n ],\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a group nested within another group using path and objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n 'group1/group2',\n { name: 'Group 3', slug: 'group3' },\n { name: 'Group 4', slug: 'group4' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAQ;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,4CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAA,EAAU,QAAQ;AAAA;AAC3B;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,oDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;A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AAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA;AAAA,cACJ,eAAA;AAAA,cACA,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS;AAAA;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group using objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n { name: 'Group 1', slug: 'group1' },\n { name: 'Group 2', slug: 'group2' },\n { name: 'Group 3', slug: 'group3' },\n ],\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a group nested within another group using path and objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n 'group1/group2',\n { name: 'Group 3', slug: 'group3' },\n { name: 'Group 4', slug: 'group4' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAQ;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,4CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR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C,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA,EAAS;AAAA,cAClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA;AAAS;AACpC;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,mEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,YAAA;AAAA,YACT,IAAA,EAAM;AAAA,cACJ,eAAA;AAAA,cACA,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA,EAAS;AAAA,cAClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA;AAAS;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabIssueCreate.cjs.js","sources":["../../src/actions/gitlabIssueCreate.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { IssueType } from '../commonGitlabConfig';\nimport { examples } from './gitlabIssueCreate.examples';\nimport { checkEpicScope, convertDate, getClient, parseRepoUrl } from '../util';\nimport { CreateIssueOptions, IssueSchema } from '@gitbeaker/rest';\nimport { getErrorMessage } from './helpers';\n\n/**\n * Creates a `gitlab:issues:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabIssueAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:issues:create',\n description: 'Creates a Gitlab issue.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.number({\n description: 'Project Id',\n }),\n title: z =>\n z.string({\n description: 'Title of the issue',\n }),\n assignees: z =>\n z\n .array(z.number(), {\n description: 'IDs of the users to assign the issue to.',\n })\n .optional(),\n confidential: z =>\n z\n .boolean({\n description: 'Issue Confidentiality',\n })\n .optional(),\n description: z =>\n z\n .string({\n description: 'Issue description',\n })\n .max(1048576)\n .optional(),\n createdAt: z =>\n z\n .string({\n description: 'Creation date/time',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n dueDate: z =>\n z\n .string({\n description: 'Due date/time',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n discussionToResolve: z =>\n z\n .string({\n description:\n 'Id of a discussion to resolve. Use in combination with \"merge_request_to_resolve_discussions_of\"',\n })\n .optional(),\n epicId: z =>\n z\n .number({\n description: 'Id of the linked Epic',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .optional(),\n labels: z =>\n z\n .string({\n description: 'Labels to apply',\n })\n .optional(),\n issueType: z =>\n z\n .nativeEnum(IssueType, {\n description: 'Type of the issue',\n })\n .optional(),\n mergeRequestToResolveDiscussionsOf: z =>\n z\n .number({\n description:\n 'IID of a merge request in which to resolve all issues',\n })\n .optional(),\n milestoneId: z =>\n z\n .number({\n description: 'Global ID of a milestone to assign the issue',\n })\n .optional(),\n weight: z =>\n z\n .number({\n description: 'The issue weight',\n })\n .min(0)\n .refine(\n value => {\n return value >= 0;\n },\n {\n message: 'Valid values should be equal or greater than zero',\n },\n )\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'Issue Url',\n }),\n issueId: z =>\n z.number({\n description: 'Issue Id',\n }),\n issueIid: z =>\n z.number({\n description: 'Issue Iid',\n }),\n },\n },\n async handler(ctx) {\n try {\n const {\n repoUrl,\n projectId,\n title,\n description = '',\n confidential = false,\n assignees = [],\n createdAt = '',\n dueDate,\n discussionToResolve = '',\n epicId,\n labels = '',\n issueType,\n mergeRequestToResolveDiscussionsOf,\n milestoneId,\n weight,\n token,\n } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n let isEpicScoped = false;\n\n isEpicScoped = await ctx.checkpoint({\n key: `is.epic.scoped.${projectId}.${title}`,\n fn: async () => {\n if (epicId) {\n isEpicScoped = await checkEpicScope(api, projectId, epicId);\n\n if (isEpicScoped) {\n ctx.logger.info('Epic is within Project Scope');\n } else {\n ctx.logger.warn(\n 'Chosen epic is not within the Project Scope. The issue will be created without an associated epic.',\n );\n }\n }\n return isEpicScoped;\n },\n });\n\n const mappedCreatedAt = convertDate(\n String(createdAt),\n new Date().toISOString(),\n );\n const mappedDueDate = dueDate\n ? convertDate(String(dueDate), new Date().toISOString())\n : undefined;\n\n const issueOptions: CreateIssueOptions = {\n description,\n assigneeIds: assignees,\n confidential,\n epicId: isEpicScoped ? epicId : undefined,\n labels,\n createdAt: mappedCreatedAt,\n dueDate: mappedDueDate,\n discussionToResolve,\n issueType,\n mergeRequestToResolveDiscussionsOf,\n milestoneId,\n weight,\n };\n\n const response = await ctx.checkpoint({\n key: `issue.${projectId}.${title}`,\n fn: async () => {\n const issue = (await api.Issues.create(\n projectId,\n title,\n issueOptions,\n )) as IssueSchema;\n\n return {\n id: issue.id,\n web_url: issue.web_url,\n iid: issue.iid,\n };\n },\n });\n\n ctx.output('issueId', response.id);\n ctx.output('issueUrl', response.web_url);\n ctx.output('issueIid', response.iid);\n } catch (error: any) {\n // Handling other errors\n throw new InputError(\n `Failed to create GitLab issue: ${getErrorMessage(error)}`,\n );\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","IssueType","parseRepoUrl","getClient","checkEpicScope","convertDate","InputError","getErrorMessage"],"mappings":";;;;;;;;;AA+Ba,MAAA,uBAAA,GAA0B,CAAC,OAElC,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AACzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,sBAAA;AAAA,IACJ,WAAa,EAAA,yBAAA;AAAA,cACbC,mCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CACL,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CACL,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,WAAW,CACT,CAAA,KAAA,CA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AAAA,UACT,mBAAA;AAAA,UACA,SAAA;AAAA,UACA,kCAAA;AAAA,UACA,WAAA;AAAA,UACA;AAAA,SACF;AAEA,QAAM,MAAA,QAAA,GAAW,MAAM,GAAA,CAAI,UAAW,CAAA;AAAA,UACpC,GAAK,EAAA,CAAA,MAAA,EAAS,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA;AAAA,UAChC,IAAI,YAAY;AACd,YAAM,MAAA,KAAA,GAAS,MAAM,GAAA,CAAI,MAAO,CAAA,MAAA;AAAA,cAC9B,SAAA;AAAA,cACA,KAAA;AAAA,cACA;AAAA,aACF;AAEA,YAAO,OAAA;AAAA,cACL,IAAI,KAAM,CAAA,EAAA;AAAA,cACV,SAAS,KAAM,CAAA,OAAA;AAAA,cACf,KAAK,KAAM,CAAA;AAAA,aACb;AAAA;AACF,SACD,CAAA;AAED,QAAI,GAAA,CAAA,MAAA,CAAO,SAAW,EAAA,QAAA,CAAS,EAAE,CAAA;AACjC,QAAI,GAAA,CAAA,MAAA,CAAO,UAAY,EAAA,QAAA,CAAS,OAAO,CAAA;AACvC,QAAI,GAAA,CAAA,MAAA,CAAO,UAAY,EAAA,QAAA,CAAS,GAAG,CAAA;AAAA,eAC5B,KAAY,EAAA;AAEnB,QAAA,MAAM,IAAIC,iBAAA;AAAA,UACR,CAAA,+BAAA,EAAkCC,uBAAgB,CAAA,KAAK,CAAC,CAAA;AAAA,SAC1D;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabIssueCreate.cjs.js","sources":["../../src/actions/gitlabIssueCreate.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { IssueType } from '../commonGitlabConfig';\nimport { examples } from './gitlabIssueCreate.examples';\nimport { checkEpicScope, convertDate, getClient, parseRepoUrl } from '../util';\nimport { CreateIssueOptions, IssueSchema } from '@gitbeaker/rest';\nimport { getErrorMessage } from './helpers';\n\n/**\n * Creates a `gitlab:issues:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabIssueAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:issues:create',\n description: 'Creates a Gitlab issue.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.number({\n description: 'Project Id',\n }),\n title: z =>\n z.string({\n description: 'Title of the issue',\n }),\n assignees: z =>\n z\n .array(z.number(), {\n description: 'IDs of the users to assign the issue to.',\n })\n .optional(),\n confidential: z =>\n z\n .boolean({\n description: 'Issue Confidentiality',\n })\n .optional(),\n description: z =>\n z\n .string({\n description: 'Issue description',\n })\n .max(1048576)\n .optional(),\n createdAt: z =>\n z\n .string({\n description: 'Creation date/time',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n dueDate: z =>\n z\n .string({\n description: 'Due date/time',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n discussionToResolve: z =>\n z\n .string({\n description:\n 'Id of a discussion to resolve. Use in combination with \"merge_request_to_resolve_discussions_of\"',\n })\n .optional(),\n epicId: z =>\n z\n .number({\n description: 'Id of the linked Epic',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .optional(),\n labels: z =>\n z\n .string({\n description: 'Labels to apply',\n })\n .optional(),\n issueType: z =>\n z\n .nativeEnum(IssueType, {\n description: 'Type of the issue',\n })\n .optional(),\n mergeRequestToResolveDiscussionsOf: z =>\n z\n .number({\n description:\n 'IID of a merge request in which to resolve all issues',\n })\n .optional(),\n milestoneId: z =>\n z\n .number({\n description: 'Global ID of a milestone to assign the issue',\n })\n .optional(),\n weight: z =>\n z\n .number({\n description: 'The issue weight',\n })\n .min(0)\n .refine(\n value => {\n return value >= 0;\n },\n {\n message: 'Valid values should be equal or greater than zero',\n },\n )\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'Issue Url',\n }),\n issueId: z =>\n z.number({\n description: 'Issue Id',\n }),\n issueIid: z =>\n z.number({\n description: 'Issue Iid',\n }),\n },\n },\n async handler(ctx) {\n try {\n const {\n repoUrl,\n projectId,\n title,\n description = '',\n confidential = false,\n assignees = [],\n createdAt = '',\n dueDate,\n discussionToResolve = '',\n epicId,\n labels = '',\n issueType,\n mergeRequestToResolveDiscussionsOf,\n milestoneId,\n weight,\n token,\n } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n let isEpicScoped = false;\n\n isEpicScoped = await ctx.checkpoint({\n key: `is.epic.scoped.${projectId}.${title}`,\n fn: async () => {\n if (epicId) {\n isEpicScoped = await checkEpicScope(api, projectId, epicId);\n\n if (isEpicScoped) {\n ctx.logger.info('Epic is within Project Scope');\n } else {\n ctx.logger.warn(\n 'Chosen epic is not within the Project Scope. The issue will be created without an associated epic.',\n );\n }\n }\n return isEpicScoped;\n },\n });\n\n const mappedCreatedAt = convertDate(\n String(createdAt),\n new Date().toISOString(),\n );\n const mappedDueDate = dueDate\n ? convertDate(String(dueDate), new Date().toISOString())\n : undefined;\n\n const issueOptions: CreateIssueOptions = {\n description,\n assigneeIds: assignees,\n confidential,\n epicId: isEpicScoped ? epicId : undefined,\n labels,\n createdAt: mappedCreatedAt,\n dueDate: mappedDueDate,\n discussionToResolve,\n issueType,\n mergeRequestToResolveDiscussionsOf,\n milestoneId,\n weight,\n };\n\n const response = await ctx.checkpoint({\n key: `issue.${projectId}.${title}`,\n fn: async () => {\n const issue = (await api.Issues.create(\n projectId,\n title,\n issueOptions,\n )) as IssueSchema;\n\n return {\n id: issue.id,\n web_url: issue.web_url,\n iid: issue.iid,\n };\n },\n });\n\n ctx.output('issueId', response.id);\n ctx.output('issueUrl', response.web_url);\n ctx.output('issueIid', response.iid);\n } catch (error: any) {\n // Handling other errors\n throw new InputError(\n `Failed to create GitLab issue: ${getErrorMessage(error)}`,\n );\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","IssueType","parseRepoUrl","getClient","checkEpicScope","convertDate","InputError","getErrorMessage"],"mappings":";;;;;;;;;AA+BO,MAAM,uBAAA,GAA0B,CAAC,OAAA,KAElC;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AACzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,sBAAA;AAAA,IACJ,WAAA,EAAa,yBAAA;AAAA,cACbC,mCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAA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A;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabIssueCreate.examples.cjs.js","sources":["../../src/actions/gitlabIssueCreate.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\nimport { commonGitlabConfigExample } from '../commonGitlabConfig';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a GitLab issue with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n description: 'This is the description of the issue',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with assignees and date options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18],\n description: 'This is the description of the issue',\n createdAt: '2022-09-27T18:00:00.000Z',\n dueDate: '2022-09-28T12:00:00.000Z',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab Issue with several options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18, 15],\n description: 'This is the description of the issue',\n confidential: false,\n createdAt: '2022-09-27T18:00:00.000Z',\n dueDate: '2022-09-28T12:00:00.000Z',\n discussionToResolve: '1',\n epicId: 1,\n labels: 'phase1:label1,phase2:label2',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with token',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n description: 'This is the description of the issue',\n token: 'sample token',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with a specific milestone and weight',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue with Milestone',\n description: 'This is the description of the issue',\n milestoneId: 5,\n weight: 3,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type INCIDENT',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'incident',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type TEST',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'test_case',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type TASK with assignees',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'task',\n assignees: [18, 22],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type ISSUE and close it',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'issue',\n stateEvent: 'close',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type INCIDENT and reopen it',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'incident',\n stateEvent: 'reopen',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a GitLab issue to resolve a discussion in a merge request',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue for MR Discussion',\n description: 'This is the description of the issue',\n mergeRequestToResolveDiscussionsOf: 42,\n discussionToResolve: 'abc123',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml","commonGitlabConfigExample"],"mappings":";;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,4CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,QAAA;AAAA,UACN,MAAQ,EAAA,sBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,YAAA;AAAA,YACP,WAAa,EAAA;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uDAAA;AAAA,IACb,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;A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O,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,yBAAA;AAAA,YACP,WAAa,EAAA,sCAAA;AAAA,YACb,SAAW,EAAA,UAAA;AAAA,YACX,UAAY,EAAA;AAAA;AACd;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,kEAAA;AAAA,IACF,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,QAAA;AAAA,UACN,MAAQ,EAAA,sBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,8BAAA;AAAA,YACP,WAAa,EAAA,sCAAA;AAAA,YACb,kCAAoC,EAAA,EAAA;AAAA,YACpC,mBAAqB,EAAA;AAAA;AACvB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlabIssueCreate.examples.cjs.js","sources":["../../src/actions/gitlabIssueCreate.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\nimport { commonGitlabConfigExample } from '../commonGitlabConfig';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a GitLab issue with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n description: 'This is the description of the issue',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with assignees and date options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18],\n description: 'This is the description of the issue',\n createdAt: '2022-09-27T18:00:00.000Z',\n dueDate: '2022-09-28T12:00:00.000Z',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab Issue with several options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18, 15],\n description: 'This is the description of the issue',\n confidential: false,\n createdAt: '2022-09-27T18:00:00.000Z',\n dueDate: '2022-09-28T12:00:00.000Z',\n discussionToResolve: '1',\n epicId: 1,\n labels: 'phase1:label1,phase2:label2',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with token',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n description: 'This is the description of the issue',\n token: 'sample token',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue with a specific milestone and weight',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue with Milestone',\n description: 'This is the description of the issue',\n milestoneId: 5,\n weight: 3,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type INCIDENT',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'incident',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type TEST',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'test_case',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type TASK with assignees',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'task',\n assignees: [18, 22],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type ISSUE and close it',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'issue',\n stateEvent: 'close',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab issue of type INCIDENT and reopen it',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Test Issue',\n description: 'This is the description of the issue',\n issueType: 'incident',\n stateEvent: 'reopen',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a GitLab issue to resolve a discussion in a merge request',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'Issues',\n action: 'gitlab:issues:create',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue for MR Discussion',\n description: 'This is the description of the issue',\n mergeRequestToResolveDiscussionsOf: 42,\n discussionToRes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AA,EAAqB;AAAA;AACvB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabIssueEdit.cjs.js","sources":["../../src/actions/gitlabIssueEdit.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { IssueStateEvent, IssueType } from '../commonGitlabConfig';\nimport { examples } from './gitlabIssueEdit.examples';\nimport { checkEpicScope, convertDate, getClient, parseRepoUrl } from '../util';\nimport { EditIssueOptions, IssueSchema } from '@gitbeaker/rest';\nimport { getErrorMessage } from './helpers';\n\n/**\n * Creates a `gitlab:issue:edit` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const editGitlabIssueAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:issue:edit',\n description: 'Edit a Gitlab issue.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.number({\n description:\n 'The global ID or URL-encoded path of the project owned by the authenticated user.',\n }),\n issueIid: z =>\n z.number({\n description: \"The internal ID of a project's issue\",\n }),\n addLabels: z =>\n z\n .string({\n description:\n 'Comma-separated label names to add to an issue. If a label does not already exist, this creates a new project label and assigns it to the issue.',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.number(), {\n description: 'IDs of the users to assign the issue to.',\n })\n .optional(),\n confidential: z =>\n z\n .boolean({\n description: 'Updates an issue to be confidential.',\n })\n .optional(),\n description: z =>\n z\n .string({\n description:\n 'The description of an issue. Limited to 1,048,576 characters.',\n })\n .max(1048576)\n .optional(),\n discussionLocked: z =>\n z\n .boolean({\n description:\n 'Flag indicating if the issue discussion is locked. If the discussion is locked only project members can add or edit comments.',\n })\n .optional(),\n dueDate: z =>\n z\n .string({\n description:\n 'The due date. Date time string in the format YYYY-MM-DD, for example 2016-03-11.',\n })\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, 'Invalid date format. Use YYYY-MM-DD')\n .optional(),\n epicId: z =>\n z\n .number({\n description:\n 'ID of the epic to add the issue to. Valid values are greater than or equal to 0.',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .optional(),\n issueType: z =>\n z\n .nativeEnum(IssueType, {\n description:\n 'Updates the type of issue. One of issue, incident, test_case or task.',\n })\n .optional(),\n labels: z =>\n z\n .string({\n description:\n 'Comma-separated label names for an issue. Set to an empty string to unassign all labels. If a label does not already exist, this creates a new project label and assigns it to the issue.',\n })\n .optional(),\n milestoneId: z =>\n z\n .number({\n description:\n 'The global ID of a milestone to assign the issue to. Set to 0 or provide an empty value to unassign a milestone',\n })\n .optional(),\n removeLabels: z =>\n z\n .string({\n description:\n 'Comma-separated label names to remove from an issue.',\n })\n .optional(),\n stateEvent: z =>\n z\n .nativeEnum(IssueStateEvent, {\n description:\n 'The state event of an issue. To close the issue, use close, and to reopen it, use reopen.',\n })\n .optional(),\n title: z =>\n z\n .string({\n description: 'The title of an issue.',\n })\n .optional(),\n updatedAt: z =>\n z\n .string({\n description:\n 'When the issue was updated. Date time string, ISO 8601 formatted',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n weight: z =>\n z\n .number({\n description: 'The issue weight',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .max(10, 'Valid values should be equal or less than 10')\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'Issue WebUrl',\n }),\n projectId: z =>\n z.number({\n description: 'The project id the issue belongs to WebUrl',\n }),\n issueId: z =>\n z.number({\n description: 'The issues Id',\n }),\n issueIid: z =>\n z.number({\n description: \"The issues internal ID of a project's issue\",\n }),\n state: z =>\n z.string({\n description: 'The state event of an issue',\n }),\n title: z =>\n z.string({\n description: 'The title of an issue.',\n }),\n updatedAt: z =>\n z.string({\n description: 'The last updated time of the issue.',\n }),\n },\n },\n async handler(ctx) {\n try {\n const {\n repoUrl,\n projectId,\n title,\n addLabels,\n removeLabels,\n issueIid,\n description,\n confidential = false,\n assignees = [],\n updatedAt = '',\n dueDate,\n discussionLocked = false,\n epicId,\n labels,\n issueType,\n milestoneId,\n stateEvent,\n weight,\n token,\n } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n let isEpicScoped = false;\n\n isEpicScoped = await ctx.checkpoint({\n key: `issue.edit.is.scoped.${projectId}.${epicId}`,\n fn: async () => {\n if (epicId) {\n const scoped = await checkEpicScope(api, projectId, epicId);\n\n if (scoped) {\n ctx.logger.info('Epic is within Project Scope');\n } else {\n ctx.logger.warn(\n 'Chosen epic is not within the Project Scope. The issue will be created without an associated epic.',\n );\n }\n return scoped;\n }\n return false;\n },\n });\n\n const mappedUpdatedAt = convertDate(\n String(updatedAt),\n new Date().toISOString(),\n );\n\n const editIssueOptions: EditIssueOptions = {\n addLabels,\n assigneeIds: assignees,\n confidential,\n description,\n discussionLocked,\n dueDate,\n epicId: isEpicScoped ? epicId : undefined,\n issueType,\n labels,\n milestoneId,\n removeLabels,\n stateEvent,\n title,\n updatedAt: mappedUpdatedAt,\n weight,\n };\n\n const editedIssue = await ctx.checkpoint({\n key: `issue.edit.${projectId}.${issueIid}`,\n fn: async () => {\n const response = (await api.Issues.edit(\n projectId,\n issueIid,\n editIssueOptions,\n )) as IssueSchema;\n\n return {\n issueId: response.id,\n issueUrl: response.web_url,\n projectId: response.project_id,\n issueIid: response.iid,\n title: response.title,\n state: response.state,\n updatedAt: response.updated_at,\n };\n },\n });\n\n ctx.output('issueId', editedIssue.issueId);\n ctx.output('projectId', editedIssue.projectId);\n ctx.output('issueUrl', editedIssue.issueUrl);\n ctx.output('issueIid', editedIssue.issueIid);\n ctx.output('title', editedIssue.title);\n ctx.output('state', editedIssue.state);\n ctx.output('updatedAt', editedIssue.updatedAt);\n } catch (error: any) {\n // Handling other errors\n throw new InputError(\n `Failed to edit/modify GitLab issue: ${getErrorMessage(error)}`,\n );\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","IssueType","IssueStateEvent","parseRepoUrl","getClient","checkEpicScope","convertDate","InputError","getErrorMessage"],"mappings":";;;;;;;;;AA+Ba,MAAA,qBAAA,GAAwB,CAAC,OAEhC,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AACzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,mBAAA;AAAA,IACJ,WAAa,EAAA,sBAAA;AAAA,cACbC,iCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CACL,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WACE,EAAA;AAA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AAA;AAAA,cACnB,WAAW,QAAS,CAAA,UAAA;AAAA,cACpB,UAAU,QAAS,CAAA,GAAA;AAAA,cACnB,OAAO,QAAS,CAAA,KAAA;AAAA,cAChB,OAAO,QAAS,CAAA,KAAA;AAAA,cAChB,WAAW,QAAS,CAAA;AAAA,aACtB;AAAA;AACF,SACD,CAAA;AAED,QAAI,GAAA,CAAA,MAAA,CAAO,SAAW,EAAA,WAAA,CAAY,OAAO,CAAA;AACzC,QAAI,GAAA,CAAA,MAAA,CAAO,WAAa,EAAA,WAAA,CAAY,SAAS,CAAA;AAC7C,QAAI,GAAA,CAAA,MAAA,CAAO,UAAY,EAAA,WAAA,CAAY,QAAQ,CAAA;AAC3C,QAAI,GAAA,CAAA,MAAA,CAAO,UAAY,EAAA,WAAA,CAAY,QAAQ,CAAA;AAC3C,QAAI,GAAA,CAAA,MAAA,CAAO,OAAS,EAAA,WAAA,CAAY,KAAK,CAAA;AACrC,QAAI,GAAA,CAAA,MAAA,CAAO,OAAS,EAAA,WAAA,CAAY,KAAK,CAAA;AACrC,QAAI,GAAA,CAAA,MAAA,CAAO,WAAa,EAAA,WAAA,CAAY,SAAS,CAAA;AAAA,eACtC,KAAY,EAAA;AAEnB,QAAA,MAAM,IAAIC,iBAAA;AAAA,UACR,CAAA,oCAAA,EAAuCC,uBAAgB,CAAA,KAAK,CAAC,CAAA;AAAA,SAC/D;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabIssueEdit.cjs.js","sources":["../../src/actions/gitlabIssueEdit.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { IssueStateEvent, IssueType } from '../commonGitlabConfig';\nimport { examples } from './gitlabIssueEdit.examples';\nimport { checkEpicScope, convertDate, getClient, parseRepoUrl } from '../util';\nimport { EditIssueOptions, IssueSchema } from '@gitbeaker/rest';\nimport { getErrorMessage } from './helpers';\n\n/**\n * Creates a `gitlab:issue:edit` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const editGitlabIssueAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:issue:edit',\n description: 'Edit a Gitlab issue.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.number({\n description:\n 'The global ID or URL-encoded path of the project owned by the authenticated user.',\n }),\n issueIid: z =>\n z.number({\n description: \"The internal ID of a project's issue\",\n }),\n addLabels: z =>\n z\n .string({\n description:\n 'Comma-separated label names to add to an issue. If a label does not already exist, this creates a new project label and assigns it to the issue.',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.number(), {\n description: 'IDs of the users to assign the issue to.',\n })\n .optional(),\n confidential: z =>\n z\n .boolean({\n description: 'Updates an issue to be confidential.',\n })\n .optional(),\n description: z =>\n z\n .string({\n description:\n 'The description of an issue. Limited to 1,048,576 characters.',\n })\n .max(1048576)\n .optional(),\n discussionLocked: z =>\n z\n .boolean({\n description:\n 'Flag indicating if the issue discussion is locked. If the discussion is locked only project members can add or edit comments.',\n })\n .optional(),\n dueDate: z =>\n z\n .string({\n description:\n 'The due date. Date time string in the format YYYY-MM-DD, for example 2016-03-11.',\n })\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, 'Invalid date format. Use YYYY-MM-DD')\n .optional(),\n epicId: z =>\n z\n .number({\n description:\n 'ID of the epic to add the issue to. Valid values are greater than or equal to 0.',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .optional(),\n issueType: z =>\n z\n .nativeEnum(IssueType, {\n description:\n 'Updates the type of issue. One of issue, incident, test_case or task.',\n })\n .optional(),\n labels: z =>\n z\n .string({\n description:\n 'Comma-separated label names for an issue. Set to an empty string to unassign all labels. If a label does not already exist, this creates a new project label and assigns it to the issue.',\n })\n .optional(),\n milestoneId: z =>\n z\n .number({\n description:\n 'The global ID of a milestone to assign the issue to. Set to 0 or provide an empty value to unassign a milestone',\n })\n .optional(),\n removeLabels: z =>\n z\n .string({\n description:\n 'Comma-separated label names to remove from an issue.',\n })\n .optional(),\n stateEvent: z =>\n z\n .nativeEnum(IssueStateEvent, {\n description:\n 'The state event of an issue. To close the issue, use close, and to reopen it, use reopen.',\n })\n .optional(),\n title: z =>\n z\n .string({\n description: 'The title of an issue.',\n })\n .optional(),\n updatedAt: z =>\n z\n .string({\n description:\n 'When the issue was updated. Date time string, ISO 8601 formatted',\n })\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/,\n 'Invalid date format. Use YYYY-MM-DDTHH:mm:ssZ or YYYY-MM-DDTHH:mm:ss.SSSZ',\n )\n .optional(),\n weight: z =>\n z\n .number({\n description: 'The issue weight',\n })\n .min(0, 'Valid values should be equal or greater than zero')\n .max(10, 'Valid values should be equal or less than 10')\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'Issue WebUrl',\n }),\n projectId: z =>\n z.number({\n description: 'The project id the issue belongs to WebUrl',\n }),\n issueId: z =>\n z.number({\n description: 'The issues Id',\n }),\n issueIid: z =>\n z.number({\n description: \"The issues internal ID of a project's issue\",\n }),\n state: z =>\n z.string({\n description: 'The state event of an issue',\n }),\n title: z =>\n z.string({\n description: 'The title of an issue.',\n }),\n updatedAt: z =>\n z.string({\n description: 'The last updated time of the issue.',\n }),\n },\n },\n async handler(ctx) {\n try {\n const {\n repoUrl,\n projectId,\n title,\n addLabels,\n removeLabels,\n issueIid,\n description,\n confidential = false,\n assignees = [],\n updatedAt = '',\n dueDate,\n discussionLocked = false,\n epicId,\n labels,\n issueType,\n milestoneId,\n stateEvent,\n weight,\n token,\n } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n let isEpicScoped = false;\n\n isEpicScoped = await ctx.checkpoint({\n key: `issue.edit.is.scoped.${projectId}.${epicId}`,\n fn: async () => {\n if (epicId) {\n const scoped = await checkEpicScope(api, projectId, epicId);\n\n if (scoped) {\n ctx.logger.info('Epic is within Project Scope');\n } else {\n ctx.logger.warn(\n 'Chosen epic is not within the Project Scope. The issue will be created without an associated epic.',\n );\n }\n return scoped;\n }\n return false;\n },\n });\n\n const mappedUpdatedAt = convertDate(\n String(updatedAt),\n new Date().toISOString(),\n );\n\n const editIssueOptions: EditIssueOptions = {\n addLabels,\n assigneeIds: assignees,\n confidential,\n description,\n discussionLocked,\n dueDate,\n epicId: isEpicScoped ? epicId : undefined,\n issueType,\n labels,\n milestoneId,\n removeLabels,\n stateEvent,\n title,\n updatedAt: mappedUpdatedAt,\n weight,\n };\n\n const editedIssue = await ctx.checkpoint({\n key: `issue.edit.${projectId}.${issueIid}`,\n fn: async () => {\n const response = (await api.Issues.edit(\n projectId,\n issueIid,\n editIssueOptions,\n )) as IssueSchema;\n\n return {\n issueId: response.id,\n issueUrl: response.web_url,\n projectId: response.project_id,\n issueIid: response.iid,\n title: response.title,\n state: response.state,\n updatedAt: response.updated_at,\n };\n },\n });\n\n ctx.output('issueId', editedIssue.issueId);\n ctx.output('projectId', editedIssue.projectId);\n ctx.output('issueUrl', editedIssue.issueUrl);\n ctx.output('issueIid', editedIssue.issueIid);\n ctx.output('title', editedIssue.title);\n ctx.output('state', editedIssue.state);\n ctx.output('updatedAt', editedIssue.updatedAt);\n } catch (error: any) {\n // Handling other errors\n throw new InputError(\n `Failed to edit/modify GitLab issue: ${getErrorMessage(error)}`,\n );\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","IssueType","IssueStateEvent","parseRepoUrl","getClient","checkEpicScope","convertDate","InputError","getErrorMessage"],"mappings":";;;;;;;;;AA+BO,MAAM,qBAAA,GAAwB,CAAC,OAAA,KAEhC;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AACzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,mBAAA;AAAA,IACJ,WAAA,EAAa,sBAAA;AAAA,cACbC,iCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,SAAA,EAAW,CAAA,CAAA,KACT,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EACE;AAAA,SACH,CAAA;AAAA,QACH,QAAA,EAAU,CAAA,CAAA,KACR,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,SAAA,EAAW,CAAA,CAAA,KACT,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,WAAW,CAAA,CAAA,KACT,CAAA,CACG,KAAA,CAAM,CAAA,CAAE,QAAO,EAAG;AAAA,UACjB,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,YAAA,EAAc,CAAA,CAAA,KACZ,CAAA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,MAAA,CAAO,UAAA,EAAY,WAAA,CAAY,QAAQ,CAAA;AAC3C,QAAA,GAAA,CAAI,MAAA,CAAO,UAAA,EAAY,WAAA,CAAY,QAAQ,CAAA;AAC3C,QAAA,GAAA,CAAI,MAAA,CAAO,OAAA,EAAS,WAAA,CAAY,KAAK,CAAA;AACrC,QAAA,GAAA,CAAI,MAAA,CAAO,OAAA,EAAS,WAAA,CAAY,KAAK,CAAA;AACrC,QAAA,GAAA,CAAI,MAAA,CAAO,WAAA,EAAa,WAAA,CAAY,SAAS,CAAA;AAAA,MAC/C,SAAS,KAAA,EAAY;AAEnB,QAAA,MAAM,IAAIC,iBAAA;AAAA,UACR,CAAA,oCAAA,EAAuCC,uBAAA,CAAgB,KAAK,CAAC,CAAA;AAAA,SAC/D;AAAA,MACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabIssueEdit.examples.cjs.js","sources":["../../src/actions/gitlabIssueEdit.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\nimport { commonGitlabConfigExample } from '../commonGitlabConfig';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Edit a GitLab issue with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Modified Test Issue',\n description: 'This is a modified description of the issue',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a GitLab issue with assignees and date options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18],\n description: 'This is the edited description of the issue',\n updatedAt: '2024-05-10T18:00:00.000Z',\n dueDate: '2024-09-28',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab Issue with several options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Edit Issue',\n assignees: [18, 15],\n description: 'This is the description of the issue',\n confidential: false,\n updatedAt: '2024-05-10T18:00:00.000Z',\n dueDate: '2024-09-28',\n discussionLocked: true,\n epicId: 1,\n labels: 'phase1:label1,phase2:label2',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change its state to close',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n stateEvent: 'close',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change its state to reopened',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n stateEvent: 'reopen',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Edit a gitlab issue to assign it to multiple users and set milestone',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test issue with milestone',\n assignees: [18, 20],\n description: 'This issue has milestone set',\n milestoneId: 5,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to add weight and update labels',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with weight and labels',\n description: 'This issue has weight and new labels',\n weight: 3,\n labels: 'bug,urgent',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to make it confidential',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Issue',\n description: 'This issue is confidential',\n confidential: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to lock the discussion',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Locked Discussion Issue',\n description: 'This discussion on this issue is locked',\n discussionLocked: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to remove labels and update milestone',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with labels removed and milestone updated',\n description: 'This issue has labels removed and milestone updated',\n removeLabels: 'phase1:label1',\n milestoneId: 6,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to remove some labels and new ones',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with labels updated',\n description: 'This issue has labels removed and new ones added',\n removeLabels: 'bug,urgent',\n labels: 'enhancement:documentation',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change issue type and add labels',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with type and labels',\n description: 'This issue has been changes and new labels added',\n labels: 'task,high-priority',\n issueType: 'task',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml","commonGitlabConfigExample"],"mappings":";;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,0CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,YAAA;AAAA,UACN,MAAQ,EAAA,mBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,qBAAA;AAAA,YACP,WAAa,EAAA;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,qDAAA;AAAA,IACb,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,YAAA;AAAA,UACN,MAAQ,EAAA,mBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,YAAA;AAAA,YACP,SAAA,EAAW,CAAC,EAAE,CAAA;AAAA,YACd,WAAa,EAAA,6CAAA;AAAA,YACb,SAAW,EAAA,0BAAA;AAAA,YACX,OAAS,EAAA;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,4CAAA;AAAA,IACb,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,YA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H;AAAA,EACA;AAAA,IACE,WAAa,EAAA,yDAAA;AAAA,IACb,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,YAAA;AAAA,UACN,MAAQ,EAAA,mBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,KAAO,EAAA,4BAAA;AAAA,YACP,WAAa,EAAA,kDAAA;AAAA,YACb,MAAQ,EAAA,oBAAA;AAAA,YACR,SAAW,EAAA;AAAA;AACb;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlabIssueEdit.examples.cjs.js","sources":["../../src/actions/gitlabIssueEdit.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\nimport { commonGitlabConfigExample } from '../commonGitlabConfig';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Edit a GitLab issue with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Modified Test Issue',\n description: 'This is a modified description of the issue',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a GitLab issue with assignees and date options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Issue',\n assignees: [18],\n description: 'This is the edited description of the issue',\n updatedAt: '2024-05-10T18:00:00.000Z',\n dueDate: '2024-09-28',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab Issue with several options',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test Edit Issue',\n assignees: [18, 15],\n description: 'This is the description of the issue',\n confidential: false,\n updatedAt: '2024-05-10T18:00:00.000Z',\n dueDate: '2024-09-28',\n discussionLocked: true,\n epicId: 1,\n labels: 'phase1:label1,phase2:label2',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change its state to close',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n stateEvent: 'close',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change its state to reopened',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n stateEvent: 'reopen',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Edit a gitlab issue to assign it to multiple users and set milestone',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Test issue with milestone',\n assignees: [18, 20],\n description: 'This issue has milestone set',\n milestoneId: 5,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to add weight and update labels',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with weight and labels',\n description: 'This issue has weight and new labels',\n weight: 3,\n labels: 'bug,urgent',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to make it confidential',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Confidential Issue',\n description: 'This issue is confidential',\n confidential: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to lock the discussion',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Locked Discussion Issue',\n description: 'This discussion on this issue is locked',\n discussionLocked: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to remove labels and update milestone',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with labels removed and milestone updated',\n description: 'This issue has labels removed and milestone updated',\n removeLabels: 'phase1:label1',\n milestoneId: 6,\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to remove some labels and new ones',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with labels updated',\n description: 'This issue has labels removed and new ones added',\n removeLabels: 'bug,urgent',\n labels: 'enhancement:documentation',\n },\n },\n ],\n }),\n },\n {\n description: 'Edit a gitlab issue to change issue type and add labels',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabIssue',\n name: 'EditIssues',\n action: 'gitlab:issue:edit',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n title: 'Issue with type and labels',\n description: 'This issue has been changes and new labels added',\n labels: 'task,high-priority',\n iss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