@backstage/plugin-scaffolder-backend-module-github 0.9.7-next.0 → 0.9.7-next.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-github
2
2
 
3
+ ## 0.9.7-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - b2591f6: Fixed environment `waitTime` description incorrectly asking for milliseconds instead of minutes.
8
+ - Updated dependencies
9
+ - @backstage/backend-plugin-api@1.8.0-next.1
10
+ - @backstage/integration@2.0.0-next.2
11
+ - @backstage/plugin-catalog-node@2.1.0-next.2
12
+ - @backstage/plugin-scaffolder-node@0.13.0-next.2
13
+
14
+ ## 0.9.7-next.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+ - @backstage/integration@2.0.0-next.1
20
+ - @backstage/plugin-scaffolder-node@0.13.0-next.1
21
+ - @backstage/plugin-catalog-node@2.1.0-next.1
22
+ - @backstage/backend-plugin-api@1.7.1-next.0
23
+ - @backstage/catalog-model@1.7.6
24
+ - @backstage/config@1.3.6
25
+ - @backstage/errors@1.2.7
26
+ - @backstage/types@1.2.2
27
+
3
28
  ## 0.9.7-next.0
4
29
 
5
30
  ### Patch Changes
@@ -58,7 +58,7 @@ Wildcard characters will not match \`/\`. For example, to match tags that begin
58
58
  description: "The token to use for authorization to GitHub"
59
59
  }).optional(),
60
60
  waitTimer: (z) => z.number({
61
- description: "The time to wait before creating or updating the environment (in milliseconds)"
61
+ description: "The time to wait before creating or updating the environment (in minutes)"
62
62
  }).optional(),
63
63
  preventSelfReview: (z) => z.boolean({
64
64
  description: "Whether to prevent self-review for this environment"
@@ -1 +1 @@
1
- {"version":3,"file":"githubEnvironment.cjs.js","sources":["../../src/actions/githubEnvironment.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 {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { getOctokitOptions } from '../util';\nimport { Octokit } from 'octokit';\nimport Sodium from 'libsodium-wrappers';\nimport { examples } from './gitHubEnvironment.examples';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\n\n/**\n * Creates an `github:environment:create` Scaffolder action that creates a Github Environment.\n *\n * @public\n */\nexport function createGithubEnvironmentAction(options: {\n integrations: ScmIntegrationRegistry;\n catalog: CatalogService;\n}) {\n const { integrations, catalog } = options;\n // For more information on how to define custom actions, see\n // https://backstage.io/docs/features/software-templates/writing-custom-actions\n return createTemplateAction({\n id: 'github:environment:create',\n description: 'Creates Deployment Environments',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description:\n 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username',\n }),\n name: z =>\n z.string({\n description: `Name of the deployment environment to create`,\n }),\n deploymentBranchPolicy: z =>\n z\n .object(\n {\n protected_branches: z.boolean({\n description:\n 'Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`.',\n }),\n custom_branch_policies: z.boolean({\n description:\n 'Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`.',\n }),\n },\n {\n description:\n 'The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.',\n },\n )\n .optional(),\n customBranchPolicyNames: z =>\n z\n .array(z.string(), {\n description: `The name pattern that branches must match in order to deploy to the environment.\n\nWildcard characters will not match \\`/\\`. For example, to match branches that begin with \\`release/\\` and contain an additional single slash, use \\`release/*/*\\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n })\n .optional(),\n customTagPolicyNames: z =>\n z\n .array(z.string(), {\n description: `The name pattern that tags must match in order to deploy to the environment.\n\nWildcard characters will not match \\`/\\`. For example, to match tags that begin with \\`release/\\` and contain an additional single slash, use \\`release/*/*\\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n })\n .optional(),\n environmentVariables: z =>\n z\n .record(z.string(), {\n description: `Environment variables attached to the deployment environment`,\n })\n .optional(),\n secrets: z =>\n z\n .record(z.string(), {\n description: `Secrets attached to the deployment environment`,\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n waitTimer: z =>\n z\n .number({\n description:\n 'The time to wait before creating or updating the environment (in milliseconds)',\n })\n .optional(),\n preventSelfReview: z =>\n z\n .boolean({\n description:\n 'Whether to prevent self-review for this environment',\n })\n .optional(),\n reviewers: z =>\n z\n .array(z.string(), {\n description:\n 'Reviewers for this environment. Must be a list of Backstage entity references.',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n name,\n deploymentBranchPolicy,\n customBranchPolicyNames,\n customTagPolicyNames,\n environmentVariables,\n secrets,\n token: providedToken,\n waitTimer,\n preventSelfReview,\n reviewers,\n } = ctx.input;\n\n // When environment creation step is executed right after a repo publish step, the repository might not be available immediately.\n // Add a 2-second delay before initiating the steps in this action.\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(`No owner provided for repo ${repoUrl}`);\n }\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n token: providedToken,\n host,\n owner,\n repo,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n const repositoryId = await ctx.checkpoint({\n key: `get.repo.${owner}.${repo}`,\n fn: async () => {\n const repository = await client.rest.repos.get({\n owner: owner,\n repo: repo,\n });\n return repository.data.id;\n },\n });\n\n // convert reviewers from catalog entity to Github user or team\n const githubReviewers: { type: 'User' | 'Team'; id: number }[] = [];\n if (reviewers) {\n let reviewersEntityRefs: Array<Entity | undefined> = [];\n // Fetch reviewers from Catalog\n const catalogResponse = await catalog.getEntitiesByRefs(\n {\n entityRefs: reviewers,\n },\n {\n credentials: await ctx.getInitiatorCredentials(),\n },\n );\n if (catalogResponse?.items?.length) {\n reviewersEntityRefs = catalogResponse.items;\n }\n\n for (const reviewerEntityRef of reviewersEntityRefs) {\n if (reviewerEntityRef?.kind === 'User') {\n try {\n const userId = await ctx.checkpoint({\n key: `get.user.${reviewerEntityRef.metadata.name}`,\n fn: async () => {\n const user = await client.rest.users.getByUsername({\n username: reviewerEntityRef.metadata.name,\n });\n return user.data.id;\n },\n });\n\n githubReviewers.push({\n type: 'User',\n id: userId,\n });\n } catch (error) {\n ctx.logger.error('User not found:', error);\n }\n } else if (reviewerEntityRef?.kind === 'Group') {\n try {\n const teamId = await ctx.checkpoint({\n key: `get.team.${reviewerEntityRef.metadata.name}`,\n fn: async () => {\n const team = await client.rest.teams.getByName({\n org: owner,\n team_slug: reviewerEntityRef.metadata.name,\n });\n return team.data.id;\n },\n });\n\n githubReviewers.push({\n type: 'Team',\n id: teamId,\n });\n } catch (error) {\n ctx.logger.error('Team not found:', error);\n }\n }\n }\n }\n\n await ctx.checkpoint({\n key: `create.or.update.environment.${owner}.${repo}.${name}`,\n fn: async () => {\n await client.rest.repos.createOrUpdateEnvironment({\n owner: owner,\n repo: repo,\n environment_name: name,\n deployment_branch_policy: deploymentBranchPolicy ?? undefined,\n wait_timer: waitTimer ?? undefined,\n prevent_self_review: preventSelfReview ?? undefined,\n reviewers: githubReviewers.length ? githubReviewers : undefined,\n });\n },\n });\n\n if (customBranchPolicyNames) {\n for (const item of customBranchPolicyNames) {\n await ctx.checkpoint({\n key: `create.deployment.branch.policy.branch.${owner}.${repo}.${name}.${item}`,\n fn: async () => {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'branch',\n environment_name: name,\n name: item,\n });\n },\n });\n }\n }\n\n if (customTagPolicyNames) {\n for (const item of customTagPolicyNames) {\n await ctx.checkpoint({\n key: `create.deployment.branch.policy.tag.${owner}.${repo}.${name}.${item}`,\n fn: async () => {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'tag',\n environment_name: name,\n name: item,\n });\n },\n });\n }\n }\n\n for (const [key, value] of Object.entries(environmentVariables ?? {})) {\n await ctx.checkpoint({\n key: `create.env.variable.${owner}.${repo}.${name}.${key}`,\n fn: async () => {\n await client.rest.actions.createEnvironmentVariable({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n name: key,\n value,\n });\n },\n });\n }\n\n if (secrets) {\n const { publicKey, publicKeyId } = await ctx.checkpoint({\n key: `get.env.public.key.${owner}.${repo}.${name}`,\n fn: async () => {\n const publicKeyResponse =\n await client.rest.actions.getEnvironmentPublicKey({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n });\n return {\n publicKey: publicKeyResponse.data.key,\n publicKeyId: publicKeyResponse.data.key_id,\n };\n },\n });\n\n await Sodium.ready;\n const binaryKey = Sodium.from_base64(\n publicKey,\n Sodium.base64_variants.ORIGINAL,\n );\n for (const [key, value] of Object.entries(secrets)) {\n const binarySecret = Sodium.from_string(value);\n const encryptedBinarySecret = Sodium.crypto_box_seal(\n binarySecret,\n binaryKey,\n );\n const encryptedBase64Secret = Sodium.to_base64(\n encryptedBinarySecret,\n Sodium.base64_variants.ORIGINAL,\n );\n\n await ctx.checkpoint({\n key: `create.or.update.env.secret.${owner}.${repo}.${name}.${key}`,\n fn: async () => {\n await client.rest.actions.createOrUpdateEnvironmentSecret({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n secret_name: key,\n encrypted_value: encryptedBase64Secret,\n key_id: publicKeyId,\n });\n },\n });\n }\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","Sodium"],"mappings":";;;;;;;;;;;;;AAkCO,SAAS,8BAA8B,OAAA,EAG3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,OAAA,EAAQ,GAAI,OAAA;AAGlC,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,2BAAA;AAAA,IACJ,WAAA,EAAa,iCAAA;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,EACE;AAAA,SACH,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,4CAAA;AAAA,SACd,CAAA;AAAA,QACH,sBAAA,EAAwB,OACtB,CAAA,CACG,MAAA;AAAA,UACC;AAAA,YACE,kBAAA,EAAoB,EAAE,OAAA,CAAQ;AAAA,cAC5B,WAAA,EACE;AAAA,aACH,CAAA;AAAA,YACD,sBAAA,EAAwB,EAAE,OAAA,CAAQ;AAAA,cAChC,WAAA,EACE;AAAA,aACH;AAAA,WACH;AAAA,UACA;AAAA,YACE,WAAA,EACE;AAAA;AACJ,UAED,QAAA,EAAS;AAAA,QACd,yBAAyB,CAAA,CAAA,KACvB,CAAA,CACG,KAAA,CAAM,CAAA,CAAE,QAAO,EAAG;AAAA,UACjB,WAAA,EAAa,CAAA;;AAAA,+PAAA;AAAA,SAGd,EACA,QAAA,EAAS;AAAA,QACd,sBAAsB,CAAA,CAAA,KACpB,CAAA,CACG,KAAA,CAAM,CAAA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e,YAAA;AAAA,gBACf,KAAA;AAAA,gBACA,IAAA;AAAA,gBACA,gBAAA,EAAkB,IAAA;AAAA,gBAClB,WAAA,EAAa,GAAA;AAAA,gBACb,eAAA,EAAiB,qBAAA;AAAA,gBACjB,MAAA,EAAQ;AAAA,eACT,CAAA;AAAA,YACH;AAAA,WACD,CAAA;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"githubEnvironment.cjs.js","sources":["../../src/actions/githubEnvironment.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 {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { getOctokitOptions } from '../util';\nimport { Octokit } from 'octokit';\nimport Sodium from 'libsodium-wrappers';\nimport { examples } from './gitHubEnvironment.examples';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\n\n/**\n * Creates an `github:environment:create` Scaffolder action that creates a Github Environment.\n *\n * @public\n */\nexport function createGithubEnvironmentAction(options: {\n integrations: ScmIntegrationRegistry;\n catalog: CatalogService;\n}) {\n const { integrations, catalog } = options;\n // For more information on how to define custom actions, see\n // https://backstage.io/docs/features/software-templates/writing-custom-actions\n return createTemplateAction({\n id: 'github:environment:create',\n description: 'Creates Deployment Environments',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description:\n 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username',\n }),\n name: z =>\n z.string({\n description: `Name of the deployment environment to create`,\n }),\n deploymentBranchPolicy: z =>\n z\n .object(\n {\n protected_branches: z.boolean({\n description:\n 'Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`.',\n }),\n custom_branch_policies: z.boolean({\n description:\n 'Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`.',\n }),\n },\n {\n description:\n 'The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.',\n },\n )\n .optional(),\n customBranchPolicyNames: z =>\n z\n .array(z.string(), {\n description: `The name pattern that branches must match in order to deploy to the environment.\n\nWildcard characters will not match \\`/\\`. For example, to match branches that begin with \\`release/\\` and contain an additional single slash, use \\`release/*/*\\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n })\n .optional(),\n customTagPolicyNames: z =>\n z\n .array(z.string(), {\n description: `The name pattern that tags must match in order to deploy to the environment.\n\nWildcard characters will not match \\`/\\`. For example, to match tags that begin with \\`release/\\` and contain an additional single slash, use \\`release/*/*\\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n })\n .optional(),\n environmentVariables: z =>\n z\n .record(z.string(), {\n description: `Environment variables attached to the deployment environment`,\n })\n .optional(),\n secrets: z =>\n z\n .record(z.string(), {\n description: `Secrets attached to the deployment environment`,\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n waitTimer: z =>\n z\n .number({\n description:\n 'The time to wait before creating or updating the environment (in minutes)',\n })\n .optional(),\n preventSelfReview: z =>\n z\n .boolean({\n description:\n 'Whether to prevent self-review for this environment',\n })\n .optional(),\n reviewers: z =>\n z\n .array(z.string(), {\n description:\n 'Reviewers for this environment. Must be a list of Backstage entity references.',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n name,\n deploymentBranchPolicy,\n customBranchPolicyNames,\n customTagPolicyNames,\n environmentVariables,\n secrets,\n token: providedToken,\n waitTimer,\n preventSelfReview,\n reviewers,\n } = ctx.input;\n\n // When environment creation step is executed right after a repo publish step, the repository might not be available immediately.\n // Add a 2-second delay before initiating the steps in this action.\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(`No owner provided for repo ${repoUrl}`);\n }\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n token: providedToken,\n host,\n owner,\n repo,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n const repositoryId = await ctx.checkpoint({\n key: `get.repo.${owner}.${repo}`,\n fn: async () => {\n const repository = await client.rest.repos.get({\n owner: owner,\n repo: repo,\n });\n return repository.data.id;\n },\n });\n\n // convert reviewers from catalog entity to Github user or team\n const githubReviewers: { type: 'User' | 'Team'; id: number }[] = [];\n if (reviewers) {\n let reviewersEntityRefs: Array<Entity | undefined> = [];\n // Fetch reviewers from Catalog\n const catalogResponse = await catalog.getEntitiesByRefs(\n {\n entityRefs: reviewers,\n },\n {\n credentials: await ctx.getInitiatorCredentials(),\n },\n );\n if (catalogResponse?.items?.length) {\n reviewersEntityRefs = catalogResponse.items;\n }\n\n for (const reviewerEntityRef of reviewersEntityRefs) {\n if (reviewerEntityRef?.kind === 'User') {\n try {\n const userId = await ctx.checkpoint({\n key: `get.user.${reviewerEntityRef.metadata.name}`,\n fn: async () => {\n const user = await client.rest.users.getByUsername({\n username: reviewerEntityRef.metadata.name,\n });\n return user.data.id;\n },\n });\n\n githubReviewers.push({\n type: 'User',\n id: userId,\n });\n } catch (error) {\n ctx.logger.error('User not found:', error);\n }\n } else if (reviewerEntityRef?.kind === 'Group') {\n try {\n const teamId = await ctx.checkpoint({\n key: `get.team.${reviewerEntityRef.metadata.name}`,\n fn: async () => {\n const team = await client.rest.teams.getByName({\n org: owner,\n team_slug: reviewerEntityRef.metadata.name,\n });\n return team.data.id;\n },\n });\n\n githubReviewers.push({\n type: 'Team',\n id: teamId,\n });\n } catch (error) {\n ctx.logger.error('Team not found:', error);\n }\n }\n }\n }\n\n await ctx.checkpoint({\n key: `create.or.update.environment.${owner}.${repo}.${name}`,\n fn: async () => {\n await client.rest.repos.createOrUpdateEnvironment({\n owner: owner,\n repo: repo,\n environment_name: name,\n deployment_branch_policy: deploymentBranchPolicy ?? undefined,\n wait_timer: waitTimer ?? undefined,\n prevent_self_review: preventSelfReview ?? undefined,\n reviewers: githubReviewers.length ? githubReviewers : undefined,\n });\n },\n });\n\n if (customBranchPolicyNames) {\n for (const item of customBranchPolicyNames) {\n await ctx.checkpoint({\n key: `create.deployment.branch.policy.branch.${owner}.${repo}.${name}.${item}`,\n fn: async () => {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'branch',\n environment_name: name,\n name: item,\n });\n },\n });\n }\n }\n\n if (customTagPolicyNames) {\n for (const item of customTagPolicyNames) {\n await ctx.checkpoint({\n key: `create.deployment.branch.policy.tag.${owner}.${repo}.${name}.${item}`,\n fn: async () => {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'tag',\n environment_name: name,\n name: item,\n });\n },\n });\n }\n }\n\n for (const [key, value] of Object.entries(environmentVariables ?? {})) {\n await ctx.checkpoint({\n key: `create.env.variable.${owner}.${repo}.${name}.${key}`,\n fn: async () => {\n await client.rest.actions.createEnvironmentVariable({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n name: key,\n value,\n });\n },\n });\n }\n\n if (secrets) {\n const { publicKey, publicKeyId } = await ctx.checkpoint({\n key: `get.env.public.key.${owner}.${repo}.${name}`,\n fn: async () => {\n const publicKeyResponse =\n await client.rest.actions.getEnvironmentPublicKey({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n });\n return {\n publicKey: publicKeyResponse.data.key,\n publicKeyId: publicKeyResponse.data.key_id,\n };\n },\n });\n\n await Sodium.ready;\n const binaryKey = Sodium.from_base64(\n publicKey,\n Sodium.base64_variants.ORIGINAL,\n );\n for (const [key, value] of Object.entries(secrets)) {\n const binarySecret = Sodium.from_string(value);\n const encryptedBinarySecret = Sodium.crypto_box_seal(\n binarySecret,\n binaryKey,\n );\n const encryptedBase64Secret = Sodium.to_base64(\n encryptedBinarySecret,\n Sodium.base64_variants.ORIGINAL,\n );\n\n await ctx.checkpoint({\n key: `create.or.update.env.secret.${owner}.${repo}.${name}.${key}`,\n fn: async () => {\n await client.rest.actions.createOrUpdateEnvironmentSecret({\n repository_id: repositoryId,\n owner: owner,\n repo: repo,\n environment_name: name,\n secret_name: key,\n encrypted_value: encryptedBase64Secret,\n key_id: publicKeyId,\n });\n },\n });\n }\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","Sodium"],"mappings":";;;;;;;;;;;;;AAkCO,SAAS,8BAA8B,OAAA,EAG3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,OAAA,EAAQ,GAAI,OAAA;AAGlC,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,2BAAA;AAAA,IACJ,WAAA,EAAa,iCAAA;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,EACE;AAAA,SACH,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,4CAAA;AAAA,SACd,CAAA;AAAA,QACH,sBAAA,EAAwB,OACtB,CAAA,CACG,MAAA;AAAA,UACC;AAAA,YACE,kBAAA,EAAoB,EAAE,OAAA,CAAQ;A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;AAAA,YACnC,YAAA;AAAA,YACA;AAAA,WACF;AACA,UAAA,MAAM,wBAAwBA,uBAAA,CAAO,SAAA;AAAA,YACnC,qBAAA;AAAA,YACAA,wBAAO,eAAA,CAAgB;AAAA,WACzB;AAEA,UAAA,MAAM,IAAI,UAAA,CAAW;AAAA,YACnB,GAAA,EAAK,+BAA+B,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,EAAI,IAAI,IAAI,GAAG,CAAA,CAAA;AAAA,YAChE,IAAI,YAAY;AACd,cAAA,MAAM,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,+BAAA,CAAgC;AAAA,gBACxD,aAAA,EAAe,YAAA;AAAA,gBACf,KAAA;AAAA,gBACA,IAAA;AAAA,gBACA,gBAAA,EAAkB,IAAA;AAAA,gBAClB,WAAA,EAAa,GAAA;AAAA,gBACb,eAAA,EAAiB,qBAAA;AAAA,gBACjB,MAAA,EAAQ;AAAA,eACT,CAAA;AAAA,YACH;AAAA,WACD,CAAA;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-github",
3
- "version": "0.9.7-next.0",
3
+ "version": "0.9.7-next.2",
4
4
  "description": "The github module for @backstage/plugin-scaffolder-backend",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -50,13 +50,13 @@
50
50
  "test": "backstage-cli package test"
51
51
  },
52
52
  "dependencies": {
53
- "@backstage/backend-plugin-api": "1.7.1-next.0",
53
+ "@backstage/backend-plugin-api": "1.8.0-next.1",
54
54
  "@backstage/catalog-model": "1.7.6",
55
55
  "@backstage/config": "1.3.6",
56
56
  "@backstage/errors": "1.2.7",
57
- "@backstage/integration": "1.21.0-next.0",
58
- "@backstage/plugin-catalog-node": "2.1.0-next.0",
59
- "@backstage/plugin-scaffolder-node": "0.12.6-next.0",
57
+ "@backstage/integration": "2.0.0-next.2",
58
+ "@backstage/plugin-catalog-node": "2.1.0-next.2",
59
+ "@backstage/plugin-scaffolder-node": "0.13.0-next.2",
60
60
  "@backstage/types": "1.2.2",
61
61
  "@octokit/webhooks": "^10.9.2",
62
62
  "libsodium-wrappers": "^0.8.0",
@@ -66,9 +66,9 @@
66
66
  "zod": "^3.25.76"
67
67
  },
68
68
  "devDependencies": {
69
- "@backstage/backend-test-utils": "1.11.1-next.0",
70
- "@backstage/cli": "0.35.5-next.0",
71
- "@backstage/plugin-scaffolder-node-test-utils": "0.3.9-next.0",
69
+ "@backstage/backend-test-utils": "1.11.1-next.2",
70
+ "@backstage/cli": "0.36.0-next.2",
71
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.9-next.2",
72
72
  "@types/libsodium-wrappers": "^0.8.0",
73
73
  "fs-extra": "^11.2.0",
74
74
  "jsonschema": "^1.2.6"