@backstage/plugin-scaffolder-backend-module-github 0.6.2-next.2 → 0.7.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,44 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-github
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c761cf5: **BREAKING** The `publish:github` scaffolder action now defaults to initializing with a branch named "main" instead of "master" when creating new repositories.
8
+
9
+ If you or your organization have relied on all new github repositories having a default branch name of "master" you **must** set the `defaultBranch: 'master'` in your existing templates that feature the `publish:github` scaffolder action.
10
+
11
+ To keep using the name "master" for your new github repos, these are the **required** changes:
12
+
13
+ ```diff
14
+ - id: publish
15
+ name: Publish
16
+ action: publish:github
17
+ input:
18
+ allowedHosts: ['github.com']
19
+ description: This is ${{ parameters.name }}
20
+ repoUrl: ${{ parameters.repoUrl }}
21
+ + defaultBranch: 'master'
22
+ ```
23
+
24
+ ### Patch Changes
25
+
26
+ - 1af427a: Made "github:autolinks:create" action idempotent
27
+ - 79dc5ac: Made "github:deployKey:create" action idempotent
28
+ - 411c879: Add support to github:repo:create to allow branch updates
29
+ - 180ea6e: Made "github:branch-protection:create" action idempotent
30
+ - 0be1a1e: Made "publish:github" action idempotent
31
+ - a833f0f: Made "github:actions:dispatch" action idempotent
32
+ - Updated dependencies
33
+ - @backstage/plugin-scaffolder-node@0.8.1
34
+ - @backstage/backend-plugin-api@1.3.0
35
+ - @backstage/integration@1.16.3
36
+ - @backstage/catalog-client@1.9.1
37
+ - @backstage/catalog-model@1.7.3
38
+ - @backstage/config@1.3.2
39
+ - @backstage/errors@1.2.7
40
+ - @backstage/types@1.2.1
41
+
3
42
  ## 0.6.2-next.2
4
43
 
5
44
  ### Patch Changes
@@ -89,7 +89,7 @@ function createPublishGithubAction(options) {
89
89
  requiredConversationResolution = false,
90
90
  requireLastPushApproval = false,
91
91
  repoVisibility = "private",
92
- defaultBranch = "master",
92
+ defaultBranch = "main",
93
93
  protectDefaultBranch = true,
94
94
  protectEnforceAdmins = true,
95
95
  deleteBranchOnMerge = false,
@@ -1 +1 @@
1
- {"version":3,"file":"github.cjs.js","sources":["../../src/actions/github.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 { Config } from '@backstage/config';\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 {\n createGithubRepoWithCollaboratorsAndTopics,\n initRepoPushAndProtect,\n} from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './github.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitHub.\n *\n * @public\n */\nexport function createPublishGithubAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, config, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n homepage?: string;\n access?: string;\n defaultBranch?: string;\n protectDefaultBranch?: boolean;\n protectEnforceAdmins?: boolean;\n deleteBranchOnMerge?: boolean;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n allowRebaseMerge?: boolean;\n allowSquashMerge?: boolean;\n squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';\n squashMergeCommitMessage?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';\n allowMergeCommit?: boolean;\n allowAutoMerge?: boolean;\n allowUpdateBranch?: boolean;\n sourcePath?: string;\n bypassPullRequestAllowances?:\n | {\n users?: string[];\n teams?: string[];\n apps?: string[];\n }\n | undefined;\n requiredApprovingReviewCount?: number;\n restrictions?:\n | {\n users: string[];\n teams: string[];\n apps?: string[];\n }\n | undefined;\n requireCodeOwnerReviews?: boolean;\n dismissStaleReviews?: boolean;\n requiredStatusCheckContexts?: string[];\n requireBranchesToBeUpToDate?: boolean;\n requiredConversationResolution?: boolean;\n requireLastPushApproval?: boolean;\n repoVisibility?: 'private' | 'internal' | 'public';\n collaborators?: Array<\n | {\n user: string;\n access: string;\n }\n | {\n team: string;\n access: string;\n }\n | {\n /** @deprecated This field is deprecated in favor of team */\n username: string;\n access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';\n }\n >;\n hasProjects?: boolean | undefined;\n hasWiki?: boolean | undefined;\n hasIssues?: boolean | undefined;\n token?: string;\n topics?: string[];\n repoVariables?: { [key: string]: string };\n secrets?: { [key: string]: string };\n oidcCustomization?: {\n useDefault: boolean;\n includeClaimKeys?: string[];\n };\n requiredCommitSigning?: boolean;\n requiredLinearHistory?: boolean;\n customProperties?: { [key: string]: string };\n subscribe?: boolean;\n }>({\n id: 'publish:github',\n description:\n 'Initializes a git repository of contents in workspace and publishes it to GitHub.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: inputProps.repoUrl,\n description: inputProps.description,\n homepage: inputProps.homepage,\n access: inputProps.access,\n bypassPullRequestAllowances: inputProps.bypassPullRequestAllowances,\n requiredApprovingReviewCount: inputProps.requiredApprovingReviewCount,\n restrictions: inputProps.restrictions,\n requireCodeOwnerReviews: inputProps.requireCodeOwnerReviews,\n dismissStaleReviews: inputProps.dismissStaleReviews,\n requiredStatusCheckContexts: inputProps.requiredStatusCheckContexts,\n requireBranchesToBeUpToDate: inputProps.requireBranchesToBeUpToDate,\n requiredConversationResolution:\n inputProps.requiredConversationResolution,\n requireLastPushApproval: inputProps.requireLastPushApproval,\n repoVisibility: inputProps.repoVisibility,\n defaultBranch: inputProps.defaultBranch,\n protectDefaultBranch: inputProps.protectDefaultBranch,\n protectEnforceAdmins: inputProps.protectEnforceAdmins,\n deleteBranchOnMerge: inputProps.deleteBranchOnMerge,\n gitCommitMessage: inputProps.gitCommitMessage,\n gitAuthorName: inputProps.gitAuthorName,\n gitAuthorEmail: inputProps.gitAuthorEmail,\n allowMergeCommit: inputProps.allowMergeCommit,\n allowSquashMerge: inputProps.allowSquashMerge,\n squashMergeCommitTitle: inputProps.squashMergeCommitTitle,\n squashMergeCommitMessage: inputProps.squashMergeCommitMessage,\n allowRebaseMerge: inputProps.allowRebaseMerge,\n allowAutoMerge: inputProps.allowAutoMerge,\n allowUpdateBranch: inputProps.allowUpdateBranch,\n sourcePath: inputProps.sourcePath,\n collaborators: inputProps.collaborators,\n hasProjects: inputProps.hasProjects,\n hasWiki: inputProps.hasWiki,\n hasIssues: inputProps.hasIssues,\n token: inputProps.token,\n topics: inputProps.topics,\n repoVariables: inputProps.repoVariables,\n secrets: inputProps.secrets,\n oidcCustomization: inputProps.oidcCustomization,\n requiredCommitSigning: inputProps.requiredCommitSigning,\n requiredLinearHistory: inputProps.requiredLinearHistory,\n customProperties: inputProps.customProperties,\n subscribe: inputProps.subscribe,\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: outputProps.remoteUrl,\n repoContentsUrl: outputProps.repoContentsUrl,\n commitHash: outputProps.commitHash,\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n homepage,\n access,\n requireCodeOwnerReviews = false,\n dismissStaleReviews = false,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount = 1,\n restrictions,\n requiredStatusCheckContexts = [],\n requireBranchesToBeUpToDate = true,\n requiredConversationResolution = false,\n requireLastPushApproval = false,\n repoVisibility = 'private',\n defaultBranch = 'master',\n protectDefaultBranch = true,\n protectEnforceAdmins = true,\n deleteBranchOnMerge = false,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\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 token: providedToken,\n customProperties,\n subscribe = false,\n requiredCommitSigning = false,\n requiredLinearHistory = false,\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 credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n host,\n owner,\n repo,\n });\n const client = new Octokit(octokitOptions);\n\n const { remoteUrl, repoContentsUrl } = await ctx.checkpoint({\n key: `create.github.repo.${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 );\n\n return {\n remoteUrl: newRepo.clone_url,\n repoContentsUrl: `${newRepo.html_url}/blob/${defaultBranch}`,\n };\n },\n });\n\n const commitResult = await initRepoPushAndProtect(\n remoteUrl,\n octokitOptions.auth,\n ctx.workspacePath,\n ctx.input.sourcePath,\n defaultBranch,\n protectDefaultBranch,\n protectEnforceAdmins,\n owner,\n client,\n repo,\n requireCodeOwnerReviews,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount,\n restrictions,\n requiredStatusCheckContexts,\n requireBranchesToBeUpToDate,\n requiredConversationResolution,\n requireLastPushApproval,\n config,\n ctx.logger,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\n dismissStaleReviews,\n requiredCommitSigning,\n requiredLinearHistory,\n );\n\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["createTemplateAction","examples","inputProps.repoUrl","inputProps.description","inputProps.homepage","inputProps.access","inputProps.bypassPullRequestAllowances","inputProps.requiredApprovingReviewCount","inputProps.restrictions","inputProps.requireCodeOwnerReviews","inputProps.dismissStaleReviews","inputProps.requiredStatusCheckContexts","inputProps.requireBranchesToBeUpToDate","inputProps.requiredConversationResolution","inputProps.requireLastPushApproval","inputProps.repoVisibility","inputProps.defaultBranch","inputProps.protectDefaultBranch","inputProps.protectEnforceAdmins","inputProps.deleteBranchOnMerge","inputProps.gitCommitMessage","inputProps.gitAuthorName","inputProps.gitAuthorEmail","inputProps.allowMergeCommit","inputProps.allowSquashMerge","inputProps.squashMergeCommitTitle","inputProps.squashMergeCommitMessage","inputProps.allowRebaseMerge","inputProps.allowAutoMerge","inputProps.allowUpdateBranch","inputProps.sourcePath","inputProps.collaborators","inputProps.hasProjects","inputProps.hasWiki","inputProps.hasIssues","inputProps.token","inputProps.topics","inputProps.repoVariables","inputProps.secrets","inputProps.oidcCustomization","inputProps.requiredCommitSigning","inputProps.requiredLinearHistory","inputProps.customProperties","inputProps.subscribe","outputProps.remoteUrl","outputProps.repoContentsUrl","outputProps.commitHash","parseRepoUrl","InputError","getOctokitOptions","Octokit","createGithubRepoWithCollaboratorsAndTopics","initRepoPushAndProtect"],"mappings":";;;;;;;;;;;AA0CO,SAAS,0BAA0B,OAIvC,EAAA;AACD,EA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;AACH;;;;"}
1
+ {"version":3,"file":"github.cjs.js","sources":["../../src/actions/github.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 { Config } from '@backstage/config';\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 {\n createGithubRepoWithCollaboratorsAndTopics,\n initRepoPushAndProtect,\n} from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './github.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitHub.\n *\n * @public\n */\nexport function createPublishGithubAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, config, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n homepage?: string;\n access?: string;\n defaultBranch?: string;\n protectDefaultBranch?: boolean;\n protectEnforceAdmins?: boolean;\n deleteBranchOnMerge?: boolean;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n allowRebaseMerge?: boolean;\n allowSquashMerge?: boolean;\n squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';\n squashMergeCommitMessage?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';\n allowMergeCommit?: boolean;\n allowAutoMerge?: boolean;\n allowUpdateBranch?: boolean;\n sourcePath?: string;\n bypassPullRequestAllowances?:\n | {\n users?: string[];\n teams?: string[];\n apps?: string[];\n }\n | undefined;\n requiredApprovingReviewCount?: number;\n restrictions?:\n | {\n users: string[];\n teams: string[];\n apps?: string[];\n }\n | undefined;\n requireCodeOwnerReviews?: boolean;\n dismissStaleReviews?: boolean;\n requiredStatusCheckContexts?: string[];\n requireBranchesToBeUpToDate?: boolean;\n requiredConversationResolution?: boolean;\n requireLastPushApproval?: boolean;\n repoVisibility?: 'private' | 'internal' | 'public';\n collaborators?: Array<\n | {\n user: string;\n access: string;\n }\n | {\n team: string;\n access: string;\n }\n | {\n /** @deprecated This field is deprecated in favor of team */\n username: string;\n access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';\n }\n >;\n hasProjects?: boolean | undefined;\n hasWiki?: boolean | undefined;\n hasIssues?: boolean | undefined;\n token?: string;\n topics?: string[];\n repoVariables?: { [key: string]: string };\n secrets?: { [key: string]: string };\n oidcCustomization?: {\n useDefault: boolean;\n includeClaimKeys?: string[];\n };\n requiredCommitSigning?: boolean;\n requiredLinearHistory?: boolean;\n customProperties?: { [key: string]: string };\n subscribe?: boolean;\n }>({\n id: 'publish:github',\n description:\n 'Initializes a git repository of contents in workspace and publishes it to GitHub.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: inputProps.repoUrl,\n description: inputProps.description,\n homepage: inputProps.homepage,\n access: inputProps.access,\n bypassPullRequestAllowances: inputProps.bypassPullRequestAllowances,\n requiredApprovingReviewCount: inputProps.requiredApprovingReviewCount,\n restrictions: inputProps.restrictions,\n requireCodeOwnerReviews: inputProps.requireCodeOwnerReviews,\n dismissStaleReviews: inputProps.dismissStaleReviews,\n requiredStatusCheckContexts: inputProps.requiredStatusCheckContexts,\n requireBranchesToBeUpToDate: inputProps.requireBranchesToBeUpToDate,\n requiredConversationResolution:\n inputProps.requiredConversationResolution,\n requireLastPushApproval: inputProps.requireLastPushApproval,\n repoVisibility: inputProps.repoVisibility,\n defaultBranch: inputProps.defaultBranch,\n protectDefaultBranch: inputProps.protectDefaultBranch,\n protectEnforceAdmins: inputProps.protectEnforceAdmins,\n deleteBranchOnMerge: inputProps.deleteBranchOnMerge,\n gitCommitMessage: inputProps.gitCommitMessage,\n gitAuthorName: inputProps.gitAuthorName,\n gitAuthorEmail: inputProps.gitAuthorEmail,\n allowMergeCommit: inputProps.allowMergeCommit,\n allowSquashMerge: inputProps.allowSquashMerge,\n squashMergeCommitTitle: inputProps.squashMergeCommitTitle,\n squashMergeCommitMessage: inputProps.squashMergeCommitMessage,\n allowRebaseMerge: inputProps.allowRebaseMerge,\n allowAutoMerge: inputProps.allowAutoMerge,\n allowUpdateBranch: inputProps.allowUpdateBranch,\n sourcePath: inputProps.sourcePath,\n collaborators: inputProps.collaborators,\n hasProjects: inputProps.hasProjects,\n hasWiki: inputProps.hasWiki,\n hasIssues: inputProps.hasIssues,\n token: inputProps.token,\n topics: inputProps.topics,\n repoVariables: inputProps.repoVariables,\n secrets: inputProps.secrets,\n oidcCustomization: inputProps.oidcCustomization,\n requiredCommitSigning: inputProps.requiredCommitSigning,\n requiredLinearHistory: inputProps.requiredLinearHistory,\n customProperties: inputProps.customProperties,\n subscribe: inputProps.subscribe,\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: outputProps.remoteUrl,\n repoContentsUrl: outputProps.repoContentsUrl,\n commitHash: outputProps.commitHash,\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n homepage,\n access,\n requireCodeOwnerReviews = false,\n dismissStaleReviews = false,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount = 1,\n restrictions,\n requiredStatusCheckContexts = [],\n requireBranchesToBeUpToDate = true,\n requiredConversationResolution = false,\n requireLastPushApproval = false,\n repoVisibility = 'private',\n defaultBranch = 'main',\n protectDefaultBranch = true,\n protectEnforceAdmins = true,\n deleteBranchOnMerge = false,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\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 token: providedToken,\n customProperties,\n subscribe = false,\n requiredCommitSigning = false,\n requiredLinearHistory = false,\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 credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n host,\n owner,\n repo,\n });\n const client = new Octokit(octokitOptions);\n\n const { remoteUrl, repoContentsUrl } = await ctx.checkpoint({\n key: `create.github.repo.${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 );\n\n return {\n remoteUrl: newRepo.clone_url,\n repoContentsUrl: `${newRepo.html_url}/blob/${defaultBranch}`,\n };\n },\n });\n\n const commitResult = await initRepoPushAndProtect(\n remoteUrl,\n octokitOptions.auth,\n ctx.workspacePath,\n ctx.input.sourcePath,\n defaultBranch,\n protectDefaultBranch,\n protectEnforceAdmins,\n owner,\n client,\n repo,\n requireCodeOwnerReviews,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount,\n restrictions,\n requiredStatusCheckContexts,\n requireBranchesToBeUpToDate,\n requiredConversationResolution,\n requireLastPushApproval,\n config,\n ctx.logger,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\n dismissStaleReviews,\n requiredCommitSigning,\n requiredLinearHistory,\n );\n\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["createTemplateAction","examples","inputProps.repoUrl","inputProps.description","inputProps.homepage","inputProps.access","inputProps.bypassPullRequestAllowances","inputProps.requiredApprovingReviewCount","inputProps.restrictions","inputProps.requireCodeOwnerReviews","inputProps.dismissStaleReviews","inputProps.requiredStatusCheckContexts","inputProps.requireBranchesToBeUpToDate","inputProps.requiredConversationResolution","inputProps.requireLastPushApproval","inputProps.repoVisibility","inputProps.defaultBranch","inputProps.protectDefaultBranch","inputProps.protectEnforceAdmins","inputProps.deleteBranchOnMerge","inputProps.gitCommitMessage","inputProps.gitAuthorName","inputProps.gitAuthorEmail","inputProps.allowMergeCommit","inputProps.allowSquashMerge","inputProps.squashMergeCommitTitle","inputProps.squashMergeCommitMessage","inputProps.allowRebaseMerge","inputProps.allowAutoMerge","inputProps.allowUpdateBranch","inputProps.sourcePath","inputProps.collaborators","inputProps.hasProjects","inputProps.hasWiki","inputProps.hasIssues","inputProps.token","inputProps.topics","inputProps.repoVariables","inputProps.secrets","inputProps.oidcCustomization","inputProps.requiredCommitSigning","inputProps.requiredLinearHistory","inputProps.customProperties","inputProps.subscribe","outputProps.remoteUrl","outputProps.repoContentsUrl","outputProps.commitHash","parseRepoUrl","InputError","getOctokitOptions","Octokit","createGithubRepoWithCollaboratorsAndTopics","initRepoPushAndProtect"],"mappings":";;;;;;;;;;;AA0CO,SAAS,0BAA0B,OAIvC,EAAA;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAQ,EAAA,yBAAA,EAA8B,GAAA,OAAA;AAE5D,EAAA,OAAOA,yCAwEJ,CAAA;AAAA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A,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,GAAI,CAAA;AAAA,WACN;AAEA,UAAO,OAAA;AAAA,YACL,WAAW,OAAQ,CAAA,SAAA;AAAA,YACnB,eAAiB,EAAA,CAAA,EAAG,OAAQ,CAAA,QAAQ,SAAS,aAAa,CAAA;AAAA,WAC5D;AAAA;AACF,OACD,CAAA;AAED,MAAA,MAAM,eAAe,MAAMC,8BAAA;AAAA,QACzB,SAAA;AAAA,QACA,cAAe,CAAA,IAAA;AAAA,QACf,GAAI,CAAA,aAAA;AAAA,QACJ,IAAI,KAAM,CAAA,UAAA;AAAA,QACV,aAAA;AAAA,QACA,oBAAA;AAAA,QACA,oBAAA;AAAA,QACA,KAAA;AAAA,QACA,MAAA;AAAA,QACA,IAAA;AAAA,QACA,uBAAA;AAAA,QACA,2BAAA;AAAA,QACA,4BAAA;AAAA,QACA,YAAA;AAAA,QACA,2BAAA;AAAA,QACA,2BAAA;AAAA,QACA,8BAAA;AAAA,QACA,uBAAA;AAAA,QACA,MAAA;AAAA,QACA,GAAI,CAAA,MAAA;AAAA,QACJ,gBAAA;AAAA,QACA,aAAA;AAAA,QACA,cAAA;AAAA,QACA,mBAAA;AAAA,QACA,qBAAA;AAAA,QACA;AAAA,OACF;AAEA,MAAI,GAAA,CAAA,MAAA,CAAO,YAAc,EAAA,YAAA,EAAc,UAAU,CAAA;AACjD,MAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAAA;AAC/C,GACD,CAAA;AACH;;;;"}
@@ -85,19 +85,33 @@ function createGithubDeployKeyAction(options) {
85
85
  repo
86
86
  });
87
87
  const client = new octokit.Octokit(octokitOptions);
88
- await client.rest.repos.createDeployKey({
89
- owner,
90
- repo,
91
- title: deployKeyName,
92
- key: publicKey
88
+ await ctx.checkpoint({
89
+ key: `create.deploy.key.${owner}.${repo}.${publicKey}`,
90
+ fn: async () => {
91
+ await client.rest.repos.createDeployKey({
92
+ owner,
93
+ repo,
94
+ title: deployKeyName,
95
+ key: publicKey
96
+ });
97
+ }
93
98
  });
94
- const publicKeyResponse = await client.rest.actions.getRepoPublicKey({
95
- owner,
96
- repo
99
+ const { key, keyId } = await ctx.checkpoint({
100
+ key: `get.repo.public.key.${owner}.${repo}`,
101
+ fn: async () => {
102
+ const publicKeyResponse = await client.rest.actions.getRepoPublicKey({
103
+ owner,
104
+ repo
105
+ });
106
+ return {
107
+ key: publicKeyResponse.data.key,
108
+ keyId: publicKeyResponse.data.key_id
109
+ };
110
+ }
97
111
  });
98
112
  await Sodium__default.default.ready;
99
113
  const binaryKey = Sodium__default.default.from_base64(
100
- publicKeyResponse.data.key,
114
+ key,
101
115
  Sodium__default.default.base64_variants.ORIGINAL
102
116
  );
103
117
  const binarySecret = Sodium__default.default.from_string(privateKey);
@@ -109,12 +123,17 @@ function createGithubDeployKeyAction(options) {
109
123
  encryptedBinarySecret,
110
124
  Sodium__default.default.base64_variants.ORIGINAL
111
125
  );
112
- await client.rest.actions.createOrUpdateRepoSecret({
113
- owner,
114
- repo,
115
- secret_name: privateKeySecretName,
116
- encrypted_value: encryptedBase64Secret,
117
- key_id: publicKeyResponse.data.key_id
126
+ await ctx.checkpoint({
127
+ key: `create.or.update.repo.secret.${owner}.${repo}.${keyId}`,
128
+ fn: async () => {
129
+ await client.rest.actions.createOrUpdateRepoSecret({
130
+ owner,
131
+ repo,
132
+ secret_name: privateKeySecretName,
133
+ encrypted_value: encryptedBase64Secret,
134
+ key_id: keyId
135
+ });
136
+ }
118
137
  });
119
138
  ctx.output("privateKeySecretName", privateKeySecretName);
120
139
  }
@@ -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}) {\n const { integrations } = 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 repoUrl: string;\n publicKey: string;\n privateKey: string;\n deployKeyName: string;\n privateKeySecretName?: string;\n token?: string;\n }>({\n id: 'github:deployKey:create',\n description: 'Creates and stores Deploy Keys',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'publicKey', 'privateKey', 'deployKeyName'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\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 type: 'string',\n },\n publicKey: {\n title: 'SSH Public Key',\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 type: 'string',\n },\n privateKey: {\n title: 'SSH Private Key',\n description: 'SSH Private Key generated from `ssh-keygen`',\n type: 'string',\n },\n deployKeyName: {\n title: 'Deploy Key Name',\n description: `Name of the Deploy Key`,\n type: 'string',\n },\n privateKeySecretName: {\n title: 'Private Key GitHub Secret Name',\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 type: 'string',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to GitHub',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n privateKeySecretName: {\n title: 'The GitHub Action Repo Secret Name for the Private Key',\n type: 'string',\n },\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 .toLocaleUpperCase('en-US')}_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 token: providedToken,\n host,\n owner,\n repo,\n });\n\n const client = new Octokit(octokitOptions);\n\n await client.rest.repos.createDeployKey({\n owner: owner,\n repo: repo,\n title: deployKeyName,\n key: publicKey,\n });\n const publicKeyResponse = await client.rest.actions.getRepoPublicKey({\n owner: owner,\n repo: repo,\n });\n\n await Sodium.ready;\n const binaryKey = Sodium.from_base64(\n publicKeyResponse.data.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 client.rest.actions.createOrUpdateRepoSecret({\n owner: owner,\n repo: repo,\n secret_name: privateKeySecretName,\n encrypted_value: encryptedBase64Secret,\n key_id: publicKeyResponse.data.key_id,\n });\n\n ctx.output('privateKeySecretName', privateKeySecretName);\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","Sodium"],"mappings":";;;;;;;;;;;;;AAgCO,SAAS,4BAA4B,OAEzC,EAAA;AACD,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AAGzB,EAAA,OAAOA,yCAOJ,CAAA;AAAA,IACD,EAAI,EAAA,yBAAA;AAAA,IACJ,WAAa,EAAA,gCAAA;AAAA,cACbC,iCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAU,EAAA,CAAC,SAAW,EAAA,WAAA,EAAa,cAAc,eAAe,CAAA;AAAA,QAChE,UAAY,EAAA;AAAA,UACV,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,qBAAA;AAAA,YACP,WACE,EAAA,kJAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,SAAW,EAAA;AAAA,YACT,KAAO,EAAA,gBAAA;AAAA,YACP,WACE,EAAA,iNAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,iBAAA;AAAA,YACP,WAAa,EAAA,6CAAA;AAAA,YACb,IAAM,EAAA;AAAA,WACR;AAAA,UACA,aAAe,EAAA;AAAA,YACb,KAAO,EAAA,iBAAA;AAAA,YACP,WAAa,EAAA,CAAA,sBAAA,CAAA;AAAA,YACb,IAAM,EAAA;AAAA,WACR;AAAA,UACA,oBAAsB,EAAA;AAAA,YACpB,KAAO,EAAA,gCAAA;AAAA,YACP,WACE,EAAA,mKAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,KAAO,EAAA;AAAA,YACL,KAAO,EAAA,sBAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA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AAiB,CAAA;AAAA,QACnE,KAAA;AAAA,QACA;AAAA,OACD,CAAA;AAED,MAAA,MAAMC,uBAAO,CAAA,KAAA;AACb,MAAA,MAAM,YAAYA,uBAAO,CAAA,WAAA;AAAA,QACvB,kBAAkB,IAAK,CAAA,GAAA;AAAA,QACvBA,wBAAO,eAAgB,CAAA;AAAA,OACzB;AACA,MAAM,MAAA,YAAA,GAAeA,uBAAO,CAAA,WAAA,CAAY,UAAU,CAAA;AAClD,MAAA,MAAM,wBAAwBA,uBAAO,CAAA,eAAA;AAAA,QACnC,YAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,MAAM,wBAAwBA,uBAAO,CAAA,SAAA;AAAA,QACnC,qBAAA;AAAA,QACAA,wBAAO,eAAgB,CAAA;AAAA,OACzB;AAEA,MAAM,MAAA,MAAA,CAAO,IAAK,CAAA,OAAA,CAAQ,wBAAyB,CAAA;AAAA,QACjD,KAAA;AAAA,QACA,IAAA;AAAA,QACA,WAAa,EAAA,oBAAA;AAAA,QACb,eAAiB,EAAA,qBAAA;AAAA,QACjB,MAAA,EAAQ,kBAAkB,IAAK,CAAA;AAAA,OAChC,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,wBAAwB,oBAAoB,CAAA;AAAA;AACzD,GACD,CAAA;AACH;;;;"}
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}) {\n const { integrations } = 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 repoUrl: string;\n publicKey: string;\n privateKey: string;\n deployKeyName: string;\n privateKeySecretName?: string;\n token?: string;\n }>({\n id: 'github:deployKey:create',\n description: 'Creates and stores Deploy Keys',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'publicKey', 'privateKey', 'deployKeyName'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\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 type: 'string',\n },\n publicKey: {\n title: 'SSH Public Key',\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 type: 'string',\n },\n privateKey: {\n title: 'SSH Private Key',\n description: 'SSH Private Key generated from `ssh-keygen`',\n type: 'string',\n },\n deployKeyName: {\n title: 'Deploy Key Name',\n description: `Name of the Deploy Key`,\n type: 'string',\n },\n privateKeySecretName: {\n title: 'Private Key GitHub Secret Name',\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 type: 'string',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to GitHub',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n privateKeySecretName: {\n title: 'The GitHub Action Repo Secret Name for the Private Key',\n type: 'string',\n },\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 .toLocaleUpperCase('en-US')}_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 token: providedToken,\n host,\n owner,\n repo,\n });\n\n const client = new Octokit(octokitOptions);\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","parse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MAAI,GAAA,CAAA,MAAA,CAAO,wBAAwB,oBAAoB,CAAA;AAAA;AACzD,GACD,CAAA;AACH;;;;"}
@@ -54,7 +54,7 @@ function createGithubRepoPushAction(options) {
54
54
  async handler(ctx) {
55
55
  const {
56
56
  repoUrl,
57
- defaultBranch = "master",
57
+ defaultBranch = "main",
58
58
  protectDefaultBranch = true,
59
59
  protectEnforceAdmins = true,
60
60
  gitCommitMessage = "initial commit",
@@ -1 +1 @@
1
- {"version":3,"file":"githubRepoPush.cjs.js","sources":["../../src/actions/githubRepoPush.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 { Config } from '@backstage/config';\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 { initRepoPushAndProtect } from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './githubRepoPush.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitHub.\n *\n * @public\n */\nexport function createGithubRepoPushAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, config, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n defaultBranch?: string;\n protectDefaultBranch?: boolean;\n protectEnforceAdmins?: boolean;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n requireCodeOwnerReviews?: boolean;\n dismissStaleReviews?: boolean;\n bypassPullRequestAllowances?:\n | {\n users?: string[];\n teams?: string[];\n apps?: string[];\n }\n | undefined;\n requiredApprovingReviewCount?: number;\n restrictions?:\n | {\n users: string[];\n teams: string[];\n apps?: string[];\n }\n | undefined;\n requiredStatusCheckContexts?: string[];\n requireBranchesToBeUpToDate?: boolean;\n requiredConversationResolution?: boolean;\n sourcePath?: string;\n token?: string;\n requiredCommitSigning?: boolean;\n requiredLinearHistory?: boolean;\n requireLastPushApproval?: boolean;\n }>({\n id: 'github:repo:push',\n description:\n 'Initializes a git repository of contents in workspace and publishes it to GitHub.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: inputProps.repoUrl,\n requireCodeOwnerReviews: inputProps.requireCodeOwnerReviews,\n dismissStaleReviews: inputProps.dismissStaleReviews,\n requiredStatusCheckContexts: inputProps.requiredStatusCheckContexts,\n bypassPullRequestAllowances: inputProps.bypassPullRequestAllowances,\n requiredApprovingReviewCount: inputProps.requiredApprovingReviewCount,\n restrictions: inputProps.restrictions,\n requireBranchesToBeUpToDate: inputProps.requireBranchesToBeUpToDate,\n requiredConversationResolution:\n inputProps.requiredConversationResolution,\n requireLastPushApproval: inputProps.requireLastPushApproval,\n defaultBranch: inputProps.defaultBranch,\n protectDefaultBranch: inputProps.protectDefaultBranch,\n protectEnforceAdmins: inputProps.protectEnforceAdmins,\n gitCommitMessage: inputProps.gitCommitMessage,\n gitAuthorName: inputProps.gitAuthorName,\n gitAuthorEmail: inputProps.gitAuthorEmail,\n sourcePath: inputProps.sourcePath,\n token: inputProps.token,\n requiredCommitSigning: inputProps.requiredCommitSigning,\n requiredLinearHistory: inputProps.requiredLinearHistory,\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: outputProps.remoteUrl,\n repoContentsUrl: outputProps.repoContentsUrl,\n commitHash: outputProps.commitHash,\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n defaultBranch = 'master',\n protectDefaultBranch = true,\n protectEnforceAdmins = true,\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n requireCodeOwnerReviews = false,\n dismissStaleReviews = false,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount = 1,\n restrictions,\n requiredStatusCheckContexts = [],\n requireBranchesToBeUpToDate = true,\n requiredConversationResolution = false,\n requireLastPushApproval = false,\n token: providedToken,\n requiredCommitSigning = false,\n requiredLinearHistory = false,\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 credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n host,\n owner,\n repo,\n });\n\n const client = new Octokit(octokitOptions);\n\n const targetRepo = await client.rest.repos.get({ owner, repo });\n\n const remoteUrl = targetRepo.data.clone_url;\n const repoContentsUrl = `${targetRepo.data.html_url}/blob/${defaultBranch}`;\n\n const commitHash = await ctx.checkpoint({\n key: `init.repo.publish.${owner}.${client}.${repo}`,\n fn: async () => {\n const { commitHash: hash } = await initRepoPushAndProtect(\n remoteUrl,\n octokitOptions.auth,\n ctx.workspacePath,\n ctx.input.sourcePath,\n defaultBranch,\n protectDefaultBranch,\n protectEnforceAdmins,\n owner,\n client,\n repo,\n requireCodeOwnerReviews,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount,\n restrictions,\n requiredStatusCheckContexts,\n requireBranchesToBeUpToDate,\n requiredConversationResolution,\n requireLastPushApproval,\n config,\n ctx.logger,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\n dismissStaleReviews,\n requiredCommitSigning,\n requiredLinearHistory,\n );\n return hash;\n },\n });\n\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('commitHash', commitHash);\n },\n });\n}\n"],"names":["createTemplateAction","examples","inputProps.repoUrl","inputProps.requireCodeOwnerReviews","inputProps.dismissStaleReviews","inputProps.requiredStatusCheckContexts","inputProps.bypassPullRequestAllowances","inputProps.requiredApprovingReviewCount","inputProps.restrictions","inputProps.requireBranchesToBeUpToDate","inputProps.requiredConversationResolution","inputProps.requireLastPushApproval","inputProps.defaultBranch","inputProps.protectDefaultBranch","inputProps.protectEnforceAdmins","inputProps.gitCommitMessage","inputProps.gitAuthorName","inputProps.gitAuthorEmail","inputProps.sourcePath","inputProps.token","inputProps.requiredCommitSigning","inputProps.requiredLinearHistory","outputProps.remoteUrl","outputProps.repoContentsUrl","outputProps.commitHash","parseRepoUrl","InputError","getOctokitOptions","Octokit","initRepoPushAndProtect"],"mappings":";;;;;;;;;;;AAuCO,SAAS,2BAA2B,OAIxC,EAAA;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAQ,EAAA,yBAAA,EAA8B,GAAA,OAAA;AAE5D,EAAA,OAAOA,yCAkCJ,CAAA;AAAA,IACD,EAAI,EAAA,kBAAA;AAAA,IACJ,WACE,EAAA,mFAAA;AAAA,cACFC,gCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,QACpB,UAAY,EAAA;AAAA,UACV,SAASC,uBAAW;AAAA,UACpB,yBAAyBC,uCAAW;AAAA,UACpC,qBAAqBC,mCAAW;AAAA,UAChC,6BAA6BC,2CAAW;AAAA,UACxC,6BAA6BC,2CAAW;AAAA,UACxC,8BAA8BC,4CAAW;AAAA,UACzC,cAAcC,4BAAW;AAAA,UACzB,6BAA6BC,2CAAW;AAAA,UACxC,gCACEC,8CAAW;AAAA,UACb,yBAAyBC,uCAAW;AAAA,UACpC,eAAeC,6BAAW;AAAA,UAC1B,sBAAsBC,oCAAW;AAAA,UACjC,sBAAsBC,oCAAW;AAAA,UACjC,kBAAk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;AAAA;AACT,OACD,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAC7C,MAAI,GAAA,CAAA,MAAA,CAAO,cAAc,UAAU,CAAA;AAAA;AACrC,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"githubRepoPush.cjs.js","sources":["../../src/actions/githubRepoPush.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 { Config } from '@backstage/config';\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 { initRepoPushAndProtect } from './helpers';\nimport { getOctokitOptions } from '../util';\nimport * as inputProps from './inputProperties';\nimport * as outputProps from './outputProperties';\nimport { examples } from './githubRepoPush.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to GitHub.\n *\n * @public\n */\nexport function createGithubRepoPushAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n githubCredentialsProvider?: GithubCredentialsProvider;\n}) {\n const { integrations, config, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n defaultBranch?: string;\n protectDefaultBranch?: boolean;\n protectEnforceAdmins?: boolean;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n requireCodeOwnerReviews?: boolean;\n dismissStaleReviews?: boolean;\n bypassPullRequestAllowances?:\n | {\n users?: string[];\n teams?: string[];\n apps?: string[];\n }\n | undefined;\n requiredApprovingReviewCount?: number;\n restrictions?:\n | {\n users: string[];\n teams: string[];\n apps?: string[];\n }\n | undefined;\n requiredStatusCheckContexts?: string[];\n requireBranchesToBeUpToDate?: boolean;\n requiredConversationResolution?: boolean;\n sourcePath?: string;\n token?: string;\n requiredCommitSigning?: boolean;\n requiredLinearHistory?: boolean;\n requireLastPushApproval?: boolean;\n }>({\n id: 'github:repo:push',\n description:\n 'Initializes a git repository of contents in workspace and publishes it to GitHub.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: inputProps.repoUrl,\n requireCodeOwnerReviews: inputProps.requireCodeOwnerReviews,\n dismissStaleReviews: inputProps.dismissStaleReviews,\n requiredStatusCheckContexts: inputProps.requiredStatusCheckContexts,\n bypassPullRequestAllowances: inputProps.bypassPullRequestAllowances,\n requiredApprovingReviewCount: inputProps.requiredApprovingReviewCount,\n restrictions: inputProps.restrictions,\n requireBranchesToBeUpToDate: inputProps.requireBranchesToBeUpToDate,\n requiredConversationResolution:\n inputProps.requiredConversationResolution,\n requireLastPushApproval: inputProps.requireLastPushApproval,\n defaultBranch: inputProps.defaultBranch,\n protectDefaultBranch: inputProps.protectDefaultBranch,\n protectEnforceAdmins: inputProps.protectEnforceAdmins,\n gitCommitMessage: inputProps.gitCommitMessage,\n gitAuthorName: inputProps.gitAuthorName,\n gitAuthorEmail: inputProps.gitAuthorEmail,\n sourcePath: inputProps.sourcePath,\n token: inputProps.token,\n requiredCommitSigning: inputProps.requiredCommitSigning,\n requiredLinearHistory: inputProps.requiredLinearHistory,\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: outputProps.remoteUrl,\n repoContentsUrl: outputProps.repoContentsUrl,\n commitHash: outputProps.commitHash,\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n defaultBranch = 'main',\n protectDefaultBranch = true,\n protectEnforceAdmins = true,\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n requireCodeOwnerReviews = false,\n dismissStaleReviews = false,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount = 1,\n restrictions,\n requiredStatusCheckContexts = [],\n requireBranchesToBeUpToDate = true,\n requiredConversationResolution = false,\n requireLastPushApproval = false,\n token: providedToken,\n requiredCommitSigning = false,\n requiredLinearHistory = false,\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 credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n host,\n owner,\n repo,\n });\n\n const client = new Octokit(octokitOptions);\n\n const targetRepo = await client.rest.repos.get({ owner, repo });\n\n const remoteUrl = targetRepo.data.clone_url;\n const repoContentsUrl = `${targetRepo.data.html_url}/blob/${defaultBranch}`;\n\n const commitHash = await ctx.checkpoint({\n key: `init.repo.publish.${owner}.${client}.${repo}`,\n fn: async () => {\n const { commitHash: hash } = await initRepoPushAndProtect(\n remoteUrl,\n octokitOptions.auth,\n ctx.workspacePath,\n ctx.input.sourcePath,\n defaultBranch,\n protectDefaultBranch,\n protectEnforceAdmins,\n owner,\n client,\n repo,\n requireCodeOwnerReviews,\n bypassPullRequestAllowances,\n requiredApprovingReviewCount,\n restrictions,\n requiredStatusCheckContexts,\n requireBranchesToBeUpToDate,\n requiredConversationResolution,\n requireLastPushApproval,\n config,\n ctx.logger,\n gitCommitMessage,\n gitAuthorName,\n gitAuthorEmail,\n dismissStaleReviews,\n requiredCommitSigning,\n requiredLinearHistory,\n );\n return hash;\n },\n });\n\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('commitHash', commitHash);\n },\n });\n}\n"],"names":["createTemplateAction","examples","inputProps.repoUrl","inputProps.requireCodeOwnerReviews","inputProps.dismissStaleReviews","inputProps.requiredStatusCheckContexts","inputProps.bypassPullRequestAllowances","inputProps.requiredApprovingReviewCount","inputProps.restrictions","inputProps.requireBranchesToBeUpToDate","inputProps.requiredConversationResolution","inputProps.requireLastPushApproval","inputProps.defaultBranch","inputProps.protectDefaultBranch","inputProps.protectEnforceAdmins","inputProps.gitCommitMessage","inputProps.gitAuthorName","inputProps.gitAuthorEmail","inputProps.sourcePath","inputProps.token","inputProps.requiredCommitSigning","inputProps.requiredLinearHistory","outputProps.remoteUrl","outputProps.repoContentsUrl","outputProps.commitHash","parseRepoUrl","InputError","getOctokitOptions","Octokit","initRepoPushAndProtect"],"mappings":";;;;;;;;;;;AAuCO,SAAS,2BAA2B,OAIxC,EAAA;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAQ,EAAA,yBAAA,EAA8B,GAAA,OAAA;AAE5D,EAAA,OAAOA,yCAkCJ,CAAA;AAAA,IACD,EAAI,EAAA,kBAAA;AAAA,IACJ,WACE,EAAA,mFAAA;AAAA,cACFC,gCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,QACpB,UAAY,EAAA;AAAA,UACV,SAASC,uBAAW;AAAA,UACpB,yBAAyBC,uCAAW;AAAA,UACpC,qBAAqBC,mCAAW;AAAA,UAChC,6BAA6BC,2CAAW;AAAA,UACxC,6BAA6BC,2CAAW;AAAA,UACxC,8BAA8BC,4CAAW;AAAA,UACzC,cAAcC,4BAAW;AAAA,UACzB,6BAA6BC,2CAAW;AAAA,UACxC,gCACEC,8CAAW;AAAA,UACb,yBAAyBC,uCAAW;AAAA,UACpC,eAAeC,6BAAW;AAAA,UAC1B,sBAAsBC,oCAAW;AAAA,UACjC,sBAAsBC,oCAAW;AAAA,UACjC,kBAAkBC,gCAAW;AAAA,UAC7B,eAAeC,6BAAW;AAAA,UAC1B,gBAAgBC,8BA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AAS,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAC7C,MAAI,GAAA,CAAA,MAAA,CAAO,cAAc,UAAU,CAAA;AAAA;AACrC,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.6.2-next.2",
3
+ "version": "0.7.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.2.1",
54
- "@backstage/catalog-client": "1.9.1",
55
- "@backstage/catalog-model": "1.7.3",
56
- "@backstage/config": "1.3.2",
57
- "@backstage/errors": "1.2.7",
58
- "@backstage/integration": "1.16.3-next.0",
59
- "@backstage/plugin-scaffolder-node": "0.8.1-next.1",
60
- "@backstage/types": "1.2.1",
53
+ "@backstage/backend-plugin-api": "^1.3.0",
54
+ "@backstage/catalog-client": "^1.9.1",
55
+ "@backstage/catalog-model": "^1.7.3",
56
+ "@backstage/config": "^1.3.2",
57
+ "@backstage/errors": "^1.2.7",
58
+ "@backstage/integration": "^1.16.3",
59
+ "@backstage/plugin-scaffolder-node": "^0.8.1",
60
+ "@backstage/types": "^1.2.1",
61
61
  "@octokit/webhooks": "^10.9.2",
62
62
  "libsodium-wrappers": "^0.7.11",
63
63
  "octokit": "^3.0.0",
@@ -65,9 +65,9 @@
65
65
  "yaml": "^2.0.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@backstage/backend-test-utils": "1.3.2-next.2",
69
- "@backstage/cli": "0.32.0-next.2",
70
- "@backstage/plugin-scaffolder-node-test-utils": "0.2.1-next.2",
68
+ "@backstage/backend-test-utils": "^1.4.0",
69
+ "@backstage/cli": "^0.32.0",
70
+ "@backstage/plugin-scaffolder-node-test-utils": "^0.2.1",
71
71
  "@types/libsodium-wrappers": "^0.7.10",
72
72
  "fs-extra": "^11.2.0",
73
73
  "jsonschema": "^1.2.6"