@backstage/plugin-scaffolder-backend-module-github 0.9.14-next.2 → 0.10.0
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,23 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-github
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- aced3e4: **BREAKING**: Removed unused inputs from the `github:repo:create` action schema. The following inputs were previously accepted but silently ignored, and have now been removed: `blockCreations`, `branch`, `bypassPullRequestAllowances`, `defaultBranch`, `dismissStaleReviews`, `gitAuthorEmail`, `gitAuthorName`, `gitCommitMessage`, `protectDefaultBranch`, `protectEnforceAdmins`, `requireBranchesToBeUpToDate`, `requireCodeOwnerReviews`, `requiredApprovingReviewCount`, `requiredCommitSigning`, `requiredConversationResolution`, `requiredLinearHistory`, `requiredStatusCheckContexts`, `requireLastPushApproval`, `restrictions`, and `sourcePath`. If your templates pass any of these to `github:repo:create`, remove them. Most of these inputs are supported by the `github:repo:push` action for branch protection, git authoring, and content publishing.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- bbba6b5: Added support for requiring user-provided credentials for GitHub mutation actions when `scaffolder.requireScmUserCredentials` is enabled.
|
|
12
|
+
- 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/integration@2.1.2
|
|
15
|
+
- @backstage/catalog-model@1.10.1
|
|
16
|
+
- @backstage/config@1.3.9
|
|
17
|
+
- @backstage/plugin-scaffolder-node@0.13.7
|
|
18
|
+
- @backstage/backend-plugin-api@1.10.1
|
|
19
|
+
- @backstage/plugin-catalog-node@2.2.5
|
|
20
|
+
|
|
3
21
|
## 0.9.14-next.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -50,7 +50,7 @@ function createGithubDeployKeyAction(options) {
|
|
|
50
50
|
publicKey,
|
|
51
51
|
privateKey,
|
|
52
52
|
deployKeyName,
|
|
53
|
-
privateKeySecretName = `${deployKeyName.split(" ").join("_").
|
|
53
|
+
privateKeySecretName = `${deployKeyName.split(" ").join("_").toUpperCase()}_PRIVATE_KEY`,
|
|
54
54
|
token: providedToken
|
|
55
55
|
} = ctx.input;
|
|
56
56
|
const { host, owner, repo } = pluginScaffolderNode.parseRepoUrl(repoUrl, integrations);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubDeployKey.cjs.js","sources":["../../src/actions/githubDeployKey.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 './githubDeployKey.examples';\n\n/**\n * Creates an `github:deployKey:create` Scaffolder action that creates a Deploy Key\n *\n * @public\n */\nexport function createGithubDeployKeyAction(options: {\n integrations: ScmIntegrationRegistry;\n requireScmUserCredentials?: boolean;\n}) {\n const { integrations, requireScmUserCredentials } = 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:deployKey:create',\n description: 'Creates and stores Deploy Keys',\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 publicKey: z =>\n z.string({\n description:\n 'Generated from `ssh-keygen`. Begins with `ssh-rsa`, `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `ssh-ed25519`, `sk-ecdsa-sha2-nistp256@openssh.com`, or `sk-ssh-ed25519@openssh.com`.',\n }),\n privateKey: z =>\n z.string({\n description: 'SSH Private Key generated from `ssh-keygen`',\n }),\n deployKeyName: z =>\n z.string({\n description: `Name of the Deploy Key`,\n }),\n privateKeySecretName: z =>\n z\n .string({\n description:\n 'Name of the GitHub Secret to store the private key related to the Deploy Key. Defaults to: `KEY_NAME_PRIVATE_KEY` where `KEY_NAME` is the name of the Deploy Key',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n },\n output: {\n privateKeySecretName: z =>\n z.string({\n description:\n 'The GitHub Action Repo Secret Name for the Private Key',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n publicKey,\n privateKey,\n deployKeyName,\n privateKeySecretName = `${deployKeyName\n .split(' ')\n .join('_')\n .
|
|
1
|
+
{"version":3,"file":"githubDeployKey.cjs.js","sources":["../../src/actions/githubDeployKey.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 './githubDeployKey.examples';\n\n/**\n * Creates an `github:deployKey:create` Scaffolder action that creates a Deploy Key\n *\n * @public\n */\nexport function createGithubDeployKeyAction(options: {\n integrations: ScmIntegrationRegistry;\n requireScmUserCredentials?: boolean;\n}) {\n const { integrations, requireScmUserCredentials } = 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:deployKey:create',\n description: 'Creates and stores Deploy Keys',\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 publicKey: z =>\n z.string({\n description:\n 'Generated from `ssh-keygen`. Begins with `ssh-rsa`, `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `ssh-ed25519`, `sk-ecdsa-sha2-nistp256@openssh.com`, or `sk-ssh-ed25519@openssh.com`.',\n }),\n privateKey: z =>\n z.string({\n description: 'SSH Private Key generated from `ssh-keygen`',\n }),\n deployKeyName: z =>\n z.string({\n description: `Name of the Deploy Key`,\n }),\n privateKeySecretName: z =>\n z\n .string({\n description:\n 'Name of the GitHub Secret to store the private key related to the Deploy Key. Defaults to: `KEY_NAME_PRIVATE_KEY` where `KEY_NAME` is the name of the Deploy Key',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n },\n output: {\n privateKeySecretName: z =>\n z.string({\n description:\n 'The GitHub Action Repo Secret Name for the Private Key',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n publicKey,\n privateKey,\n deployKeyName,\n privateKeySecretName = `${deployKeyName\n .split(' ')\n .join('_')\n .toUpperCase()}_PRIVATE_KEY`,\n token: providedToken,\n } = ctx.input;\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 requireScmUserCredentials,\n token: providedToken,\n host,\n owner,\n repo,\n });\n\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n await ctx.checkpoint({\n key: `create.deploy.key.${owner}.${repo}.${publicKey}`,\n fn: async () => {\n await client.rest.repos.createDeployKey({\n owner: owner,\n repo: repo,\n title: deployKeyName,\n key: publicKey,\n });\n },\n });\n\n const { key, keyId } = await ctx.checkpoint({\n key: `get.repo.public.key.${owner}.${repo}`,\n fn: async () => {\n const publicKeyResponse = await client.rest.actions.getRepoPublicKey({\n owner: owner,\n repo: repo,\n });\n return {\n key: publicKeyResponse.data.key,\n keyId: publicKeyResponse.data.key_id,\n };\n },\n });\n\n await Sodium.ready;\n const binaryKey = Sodium.from_base64(\n key,\n Sodium.base64_variants.ORIGINAL,\n );\n const binarySecret = Sodium.from_string(privateKey);\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.repo.secret.${owner}.${repo}.${keyId}`,\n fn: async () => {\n await client.rest.actions.createOrUpdateRepoSecret({\n owner: owner,\n repo: repo,\n secret_name: privateKeySecretName,\n encrypted_value: encryptedBase64Secret,\n key_id: keyId,\n });\n },\n });\n\n ctx.output('privateKeySecretName', privateKeySecretName);\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","Sodium"],"mappings":";;;;;;;;;;;;;AAgCO,SAAS,4BAA4B,OAAA,EAGzC;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA0B,GAAI,OAAA;AAGpD,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,yBAAA;AAAA,IACJ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AA,EAAO,kBAAkB,IAAA,CAAK;AAAA,WAChC;AAAA,QACF;AAAA,OACD,CAAA;AAED,MAAA,MAAMC,uBAAA,CAAO,KAAA;AACb,MAAA,MAAM,YAAYA,uBAAA,CAAO,WAAA;AAAA,QACvB,GAAA;AAAA,QACAA,wBAAO,eAAA,CAAgB;AAAA,OACzB;AACA,MAAA,MAAM,YAAA,GAAeA,uBAAA,CAAO,WAAA,CAAY,UAAU,CAAA;AAClD,MAAA,MAAM,wBAAwBA,uBAAA,CAAO,eAAA;AAAA,QACnC,YAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,MAAM,wBAAwBA,uBAAA,CAAO,SAAA;AAAA,QACnC,qBAAA;AAAA,QACAA,wBAAO,eAAA,CAAgB;AAAA,OACzB;AAEA,MAAA,MAAM,IAAI,UAAA,CAAW;AAAA,QACnB,KAAK,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAA,EAAI,IAAI,IAAI,KAAK,CAAA,CAAA;AAAA,QAC3D,IAAI,YAAY;AACd,UAAA,MAAM,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,wBAAA,CAAyB;AAAA,YACjD,KAAA;AAAA,YACA,IAAA;AAAA,YACA,WAAA,EAAa,oBAAA;AAAA,YACb,eAAA,EAAiB,qBAAA;AAAA,YACjB,MAAA,EAAQ;AAAA,WACT,CAAA;AAAA,QACH;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,wBAAwB,oBAAoB,CAAA;AAAA,IACzD;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -17,7 +17,32 @@ function createGithubRepoCreateAction(options) {
|
|
|
17
17
|
examples: githubRepoCreate_examples.examples,
|
|
18
18
|
schema: {
|
|
19
19
|
input: {
|
|
20
|
-
|
|
20
|
+
access: inputProperties.access,
|
|
21
|
+
allowAutoMerge: inputProperties.allowAutoMerge,
|
|
22
|
+
allowMergeCommit: inputProperties.allowMergeCommit,
|
|
23
|
+
allowRebaseMerge: inputProperties.allowRebaseMerge,
|
|
24
|
+
allowSquashMerge: inputProperties.allowSquashMerge,
|
|
25
|
+
allowUpdateBranch: inputProperties.allowUpdateBranch,
|
|
26
|
+
autoInit: inputProperties.autoInit,
|
|
27
|
+
collaborators: inputProperties.collaborators,
|
|
28
|
+
customProperties: inputProperties.customProperties,
|
|
29
|
+
deleteBranchOnMerge: inputProperties.deleteBranchOnMerge,
|
|
30
|
+
description: inputProperties.description,
|
|
31
|
+
hasIssues: inputProperties.hasIssues,
|
|
32
|
+
hasProjects: inputProperties.hasProjects,
|
|
33
|
+
hasWiki: inputProperties.hasWiki,
|
|
34
|
+
homepage: inputProperties.homepage,
|
|
35
|
+
oidcCustomization: inputProperties.oidcCustomization,
|
|
36
|
+
repoUrl: inputProperties.repoUrl,
|
|
37
|
+
repoVariables: inputProperties.repoVariables,
|
|
38
|
+
repoVisibility: inputProperties.repoVisibility,
|
|
39
|
+
secrets: inputProperties.secrets,
|
|
40
|
+
squashMergeCommitMessage: inputProperties.squashMergeCommitMessage,
|
|
41
|
+
squashMergeCommitTitle: inputProperties.squashMergeCommitTitle,
|
|
42
|
+
subscribe: inputProperties.subscribe,
|
|
43
|
+
token: inputProperties.token,
|
|
44
|
+
topics: inputProperties.topics,
|
|
45
|
+
workflowAccess: inputProperties.workflowAccess
|
|
21
46
|
},
|
|
22
47
|
output: {
|
|
23
48
|
remoteUrl: outputProperties.remoteUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubRepoCreate.cjs.js","sources":["../../src/actions/githubRepoCreate.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 GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { Octokit } from 'octokit';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { createGithubRepoWithCollaboratorsAndTopics } from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './githubRepoCreate.examples';\n\n/**\n * Creates a new action that initializes a git repository\n *\n * @public\n */\nexport function createGithubRepoCreateAction(options: {\n integrations: ScmIntegrationRegistry;\n githubCredentialsProvider?: GithubCredentialsProvider;\n requireScmUserCredentials?: boolean;\n}) {\n const { integrations, githubCredentialsProvider, requireScmUserCredentials } =\n options;\n\n return createTemplateAction({\n id: 'github:repo:create',\n description: 'Creates a GitHub repository.',\n examples,\n schema: {\n input: {\n
|
|
1
|
+
{"version":3,"file":"githubRepoCreate.cjs.js","sources":["../../src/actions/githubRepoCreate.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 GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { Octokit } from 'octokit';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { createGithubRepoWithCollaboratorsAndTopics } from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './githubRepoCreate.examples';\n\n/**\n * Creates a new action that initializes a git repository\n *\n * @public\n */\nexport function createGithubRepoCreateAction(options: {\n integrations: ScmIntegrationRegistry;\n githubCredentialsProvider?: GithubCredentialsProvider;\n requireScmUserCredentials?: boolean;\n}) {\n const { integrations, githubCredentialsProvider, requireScmUserCredentials } =\n options;\n\n return createTemplateAction({\n id: 'github:repo:create',\n description: 'Creates a GitHub repository.',\n examples,\n schema: {\n input: {\n access: inputProps.access,\n allowAutoMerge: inputProps.allowAutoMerge,\n allowMergeCommit: inputProps.allowMergeCommit,\n allowRebaseMerge: inputProps.allowRebaseMerge,\n allowSquashMerge: inputProps.allowSquashMerge,\n allowUpdateBranch: inputProps.allowUpdateBranch,\n autoInit: inputProps.autoInit,\n collaborators: inputProps.collaborators,\n customProperties: inputProps.customProperties,\n deleteBranchOnMerge: inputProps.deleteBranchOnMerge,\n description: inputProps.description,\n hasIssues: inputProps.hasIssues,\n hasProjects: inputProps.hasProjects,\n hasWiki: inputProps.hasWiki,\n homepage: inputProps.homepage,\n oidcCustomization: inputProps.oidcCustomization,\n repoUrl: inputProps.repoUrl,\n repoVariables: inputProps.repoVariables,\n repoVisibility: inputProps.repoVisibility,\n secrets: inputProps.secrets,\n squashMergeCommitMessage: inputProps.squashMergeCommitMessage,\n squashMergeCommitTitle: inputProps.squashMergeCommitTitle,\n subscribe: inputProps.subscribe,\n token: inputProps.token,\n topics: inputProps.topics,\n workflowAccess: inputProps.workflowAccess,\n },\n output: {\n remoteUrl: outputProps.remoteUrl,\n repoContentsUrl: outputProps.repoContentsUrl,\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n homepage,\n access,\n repoVisibility = 'private',\n deleteBranchOnMerge = false,\n allowMergeCommit = true,\n allowSquashMerge = true,\n squashMergeCommitTitle = 'COMMIT_OR_PR_TITLE',\n squashMergeCommitMessage = 'COMMIT_MESSAGES',\n allowRebaseMerge = true,\n allowAutoMerge = false,\n allowUpdateBranch = false,\n collaborators,\n hasProjects = undefined,\n hasWiki = undefined,\n hasIssues = undefined,\n topics,\n repoVariables,\n secrets,\n oidcCustomization,\n customProperties,\n subscribe,\n token: providedToken,\n autoInit = undefined,\n workflowAccess,\n } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError('Invalid repository owner provided in repoUrl');\n }\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n requireScmUserCredentials,\n credentialsProvider: githubCredentialsProvider,\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 remoteUrl = await ctx.checkpoint({\n key: `create.repo.and.topics.${owner}.${repo}`,\n fn: async () => {\n const newRepo = await createGithubRepoWithCollaboratorsAndTopics(\n client,\n repo,\n owner,\n repoVisibility,\n description,\n homepage,\n deleteBranchOnMerge,\n allowMergeCommit,\n allowSquashMerge,\n squashMergeCommitTitle,\n squashMergeCommitMessage,\n allowRebaseMerge,\n allowAutoMerge,\n allowUpdateBranch,\n access,\n collaborators,\n hasProjects,\n hasWiki,\n hasIssues,\n topics,\n repoVariables,\n secrets,\n oidcCustomization,\n customProperties,\n subscribe,\n ctx.logger,\n autoInit,\n workflowAccess,\n );\n return newRepo.clone_url;\n },\n });\n\n ctx.output('remoteUrl', remoteUrl);\n },\n });\n}\n"],"names":["createTemplateAction","examples","inputProps.access","inputProps.allowAutoMerge","inputProps.allowMergeCommit","inputProps.allowRebaseMerge","inputProps.allowSquashMerge","inputProps.allowUpdateBranch","inputProps.autoInit","inputProps.collaborators","inputProps.customProperties","inputProps.deleteBranchOnMerge","inputProps.description","inputProps.hasIssues","inputProps.hasProjects","inputProps.hasWiki","inputProps.homepage","inputProps.oidcCustomization","inputProps.repoUrl","inputProps.repoVariables","inputProps.repoVisibility","inputProps.secrets","inputProps.squashMergeCommitMessage","inputProps.squashMergeCommitTitle","inputProps.subscribe","inputProps.token","inputProps.topics","inputProps.workflowAccess","outputProps.remoteUrl","output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GAAA,CAAI,UAAA,CAAW;AAAA,QACrC,GAAA,EAAK,CAAA,uBAAA,EAA0B,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QAC5C,IAAI,YAAY;AACd,UAAA,MAAM,UAAU,MAAMC,kDAAA;AAAA,YACpB,MAAA;AAAA,YACA,IAAA;AAAA,YACA,KAAA;AAAA,YACA,cAAA;AAAA,YACA,WAAA;AAAA,YACA,QAAA;AAAA,YACA,mBAAA;AAAA,YACA,gBAAA;AAAA,YACA,gBAAA;AAAA,YACA,sBAAA;AAAA,YACA,wBAAA;AAAA,YACA,gBAAA;AAAA,YACA,cAAA;AAAA,YACA,iBAAA;AAAA,YACA,MAAA;AAAA,YACA,aAAA;AAAA,YACA,WAAA;AAAA,YACA,OAAA;AAAA,YACA,SAAA;AAAA,YACA,MAAA;AAAA,YACA,aAAA;AAAA,YACA,OAAA;AAAA,YACA,iBAAA;AAAA,YACA,gBAAA;AAAA,YACA,SAAA;AAAA,YACA,GAAA,CAAI,MAAA;AAAA,YACJ,QAAA;AAAA,YACA;AAAA,WACF;AACA,UAAA,OAAO,OAAA,CAAQ,SAAA;AAAA,QACjB;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AAAA,IACnC;AAAA,GACD,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -85,13 +85,6 @@ declare function createGithubRepoCreateAction(options: {
|
|
|
85
85
|
allowSquashMerge?: boolean | undefined;
|
|
86
86
|
allowUpdateBranch?: boolean | undefined;
|
|
87
87
|
autoInit?: boolean | undefined;
|
|
88
|
-
blockCreations?: boolean | undefined;
|
|
89
|
-
branch?: string | undefined;
|
|
90
|
-
bypassPullRequestAllowances?: {
|
|
91
|
-
users?: string[] | undefined;
|
|
92
|
-
apps?: string[] | undefined;
|
|
93
|
-
teams?: string[] | undefined;
|
|
94
|
-
} | undefined;
|
|
95
88
|
collaborators?: ({
|
|
96
89
|
user: string;
|
|
97
90
|
access: string;
|
|
@@ -100,13 +93,8 @@ declare function createGithubRepoCreateAction(options: {
|
|
|
100
93
|
access: string;
|
|
101
94
|
})[] | undefined;
|
|
102
95
|
customProperties?: Record<string, string | string[]> | undefined;
|
|
103
|
-
defaultBranch?: string | undefined;
|
|
104
96
|
deleteBranchOnMerge?: boolean | undefined;
|
|
105
97
|
description?: string | undefined;
|
|
106
|
-
dismissStaleReviews?: boolean | undefined;
|
|
107
|
-
gitAuthorEmail?: string | undefined;
|
|
108
|
-
gitAuthorName?: string | undefined;
|
|
109
|
-
gitCommitMessage?: string | undefined;
|
|
110
98
|
hasIssues?: boolean | undefined;
|
|
111
99
|
hasProjects?: boolean | undefined;
|
|
112
100
|
hasWiki?: boolean | undefined;
|
|
@@ -115,25 +103,9 @@ declare function createGithubRepoCreateAction(options: {
|
|
|
115
103
|
useDefault: boolean;
|
|
116
104
|
includeClaimKeys?: string[] | undefined;
|
|
117
105
|
} | undefined;
|
|
118
|
-
protectDefaultBranch?: boolean | undefined;
|
|
119
|
-
protectEnforceAdmins?: boolean | undefined;
|
|
120
106
|
repoVariables?: Record<string, string> | undefined;
|
|
121
107
|
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
122
|
-
requireBranchesToBeUpToDate?: boolean | undefined;
|
|
123
|
-
requireCodeOwnerReviews?: boolean | undefined;
|
|
124
|
-
requiredApprovingReviewCount?: number | undefined;
|
|
125
|
-
requiredCommitSigning?: boolean | undefined;
|
|
126
|
-
requiredConversationResolution?: boolean | undefined;
|
|
127
|
-
requiredLinearHistory?: boolean | undefined;
|
|
128
|
-
requiredStatusCheckContexts?: string[] | undefined;
|
|
129
|
-
requireLastPushApproval?: boolean | undefined;
|
|
130
|
-
restrictions?: {
|
|
131
|
-
users: string[];
|
|
132
|
-
teams: string[];
|
|
133
|
-
apps?: string[] | undefined;
|
|
134
|
-
} | undefined;
|
|
135
108
|
secrets?: Record<string, string> | undefined;
|
|
136
|
-
sourcePath?: string | undefined;
|
|
137
109
|
squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
|
|
138
110
|
squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
|
|
139
111
|
subscribe?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The github module for @backstage/plugin-scaffolder-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"test": "backstage-cli package test"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@backstage/backend-plugin-api": "1.10.1
|
|
54
|
-
"@backstage/catalog-model": "1.10.
|
|
55
|
-
"@backstage/config": "1.3.9
|
|
56
|
-
"@backstage/errors": "1.3.1",
|
|
57
|
-
"@backstage/integration": "2.1.2
|
|
58
|
-
"@backstage/plugin-catalog-node": "2.2.5
|
|
59
|
-
"@backstage/plugin-scaffolder-node": "0.13.7
|
|
60
|
-
"@backstage/types": "1.2.2",
|
|
53
|
+
"@backstage/backend-plugin-api": "^1.10.1",
|
|
54
|
+
"@backstage/catalog-model": "^1.10.1",
|
|
55
|
+
"@backstage/config": "^1.3.9",
|
|
56
|
+
"@backstage/errors": "^1.3.1",
|
|
57
|
+
"@backstage/integration": "^2.1.2",
|
|
58
|
+
"@backstage/plugin-catalog-node": "^2.2.5",
|
|
59
|
+
"@backstage/plugin-scaffolder-node": "^0.13.7",
|
|
60
|
+
"@backstage/types": "^1.2.2",
|
|
61
61
|
"@octokit/core": "^5.0.0",
|
|
62
62
|
"@octokit/plugin-retry": "^6.0.0",
|
|
63
63
|
"@octokit/webhooks": "^10.9.2",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"zod": "^3.25.76 || ^4.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@backstage/backend-test-utils": "1.11.7
|
|
72
|
-
"@backstage/cli": "0.36.6
|
|
73
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.3.15
|
|
71
|
+
"@backstage/backend-test-utils": "^1.11.7",
|
|
72
|
+
"@backstage/cli": "^0.36.6",
|
|
73
|
+
"@backstage/plugin-scaffolder-node-test-utils": "^0.3.15",
|
|
74
74
|
"@types/libsodium-wrappers": "^0.8.0",
|
|
75
75
|
"fs-extra": "^11.2.0",
|
|
76
76
|
"jsonschema": "^1.2.6"
|