@backstage/plugin-scaffolder-backend-module-github 0.10.0 → 0.10.1-next.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 +13 -0
- package/dist/actions/gitHelpers.cjs.js.map +1 -1
- package/dist/actions/gitHubEnvironment.examples.cjs.js.map +1 -1
- package/dist/actions/github.cjs.js.map +1 -1
- package/dist/actions/github.examples.cjs.js.map +1 -1
- package/dist/actions/githubActionsDispatch.cjs.js.map +1 -1
- package/dist/actions/githubActionsDispatch.examples.cjs.js.map +1 -1
- package/dist/actions/githubAutolinks.cjs.js.map +1 -1
- package/dist/actions/githubAutolinks.examples.cjs.js.map +1 -1
- package/dist/actions/githubBranchProtection.cjs.js.map +1 -1
- package/dist/actions/githubBranchProtection.examples.cjs.js.map +1 -1
- package/dist/actions/githubDeployKey.cjs.js.map +1 -1
- package/dist/actions/githubDeployKey.examples.cjs.js.map +1 -1
- package/dist/actions/githubEnvironment.cjs.js.map +1 -1
- package/dist/actions/githubIssuesCreate.cjs.js.map +1 -1
- package/dist/actions/githubIssuesCreate.examples.cjs.js.map +1 -1
- package/dist/actions/githubIssuesLabel.cjs.js.map +1 -1
- package/dist/actions/githubIssuesLabel.examples.cjs.js.map +1 -1
- package/dist/actions/githubPagesEnable.cjs.js.map +1 -1
- package/dist/actions/githubPagesEnable.examples.cjs.js.map +1 -1
- package/dist/actions/githubPullRequest.cjs.js.map +1 -1
- package/dist/actions/githubPullRequest.examples.cjs.js.map +1 -1
- package/dist/actions/githubRepoCreate.cjs.js.map +1 -1
- package/dist/actions/githubRepoCreate.examples.cjs.js.map +1 -1
- package/dist/actions/githubRepoPush.cjs.js.map +1 -1
- package/dist/actions/githubRepoPush.examples.cjs.js.map +1 -1
- package/dist/actions/githubWebhook.cjs.js.map +1 -1
- package/dist/actions/githubWebhook.examples.cjs.js.map +1 -1
- package/dist/actions/helpers.cjs.js.map +1 -1
- package/dist/actions/inputProperties.cjs.js.map +1 -1
- package/dist/actions/outputProperties.cjs.js.map +1 -1
- package/dist/autocomplete/autocomplete.cjs.js.map +1 -1
- package/dist/module.cjs.js.map +1 -1
- package/dist/util.cjs.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubIssuesCreate.cjs.js","sources":["../../src/actions/githubIssuesCreate.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 {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { InputError, toError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubIssuesCreate.examples';\n\n/**\n * Creates an issue on GitHub\n * @public\n */\nexport function createGithubIssuesCreateAction(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:issues:create',\n description: 'Creates an issue on GitHub.',\n examples,\n supportsDryRun: true,\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 repository name and `owner` is an organization or username',\n }),\n title: z =>\n z.string({\n description: 'The title of the issue',\n }),\n body: z =>\n z\n .string({\n description: 'The contents of the issue',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.string(), {\n description:\n 'Logins for Users to assign to this issue. NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise.',\n })\n .optional(),\n milestone: z =>\n z\n .union([z.string(), z.number()], {\n description:\n 'The number of the milestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.',\n })\n .optional(),\n labels: z =>\n z\n .array(z.string(), {\n description:\n 'Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.',\n })\n .optional(),\n token: z =>\n z\n .string({\n description:\n 'The `GITHUB_TOKEN` to use for authorization to GitHub',\n })\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'The URL of the created issue',\n }),\n issueNumber: z =>\n z.number({\n description: 'The number of the created issue',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n title,\n body,\n assignees,\n milestone,\n labels,\n token: providedToken,\n } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n ctx.logger.info(`Creating issue \"${title}\" on repo ${repo}`);\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 host,\n owner,\n repo,\n token: providedToken,\n });\n\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n if (ctx.isDryRun) {\n ctx.logger.info(`Performing dry run of creating issue \"${title}\"`);\n ctx.output('issueUrl', `https://github.com/${owner}/${repo}/issues/42`);\n ctx.output('issueNumber', 42);\n ctx.logger.info(`Dry run complete`);\n return;\n }\n\n try {\n const issue = await ctx.checkpoint({\n key: `github.issues.create.${owner}.${repo}.${title}`,\n fn: async () => {\n const response = await client.rest.issues.create({\n owner,\n repo,\n title,\n body,\n assignees,\n milestone,\n labels,\n });\n\n return {\n html_url: response.data.html_url,\n number: response.data.number,\n };\n },\n });\n\n if (!issue) {\n throw new Error('Failed to create issue');\n }\n\n ctx.output('issueUrl', issue.html_url);\n ctx.output('issueNumber', issue.number);\n\n ctx.logger.info(\n `Successfully created issue #${issue.number}: ${issue.html_url}`,\n );\n } catch (e) {\n const error = toError(e);\n ctx.logger.warn(\n `Failed: creating issue '${title}' on repo: '${repo}', ${error.message}`,\n );\n throw error;\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","toError"],"mappings":";;;;;;;;AAiCO,SAAS,+BAA+B,OAAA,EAI5C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,sBAAA;AAAA,IACJ,WAAA,EAAa,6BAAA;AAAA,cACbC,oCAAA;AAAA,IACA,cAAA,EAAgB,IAAA;AAAA,IAChB,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,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,WAAW,CAAA,CAAA,KACT,CAAA,CACG,KAAA,CAAM,CAAA,CAAE,QAAO,EAAG;AAAA,UACjB,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,SAAA,EAAW,CAAA,CAAA,KACT,CAAA,CACG,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAA,EAAG;AAAA,UAC/B,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,QAAQ,CAAA,CA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AAA,CAAM,MAAM,CAAA;AAEtC,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,CAAA,4BAAA,EAA+B,KAAA,CAAM,MAAM,CAAA,EAAA,EAAK,MAAM,QAAQ,CAAA;AAAA,SAChE;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,MAAM,KAAA,GAAQC,eAAQ,CAAC,CAAA;AACvB,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,2BAA2B,KAAK,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,MAAM,OAAO,CAAA;AAAA,SACxE;AACA,QAAA,MAAM,KAAA;AAAA,MACR;AAAA,IACF;AAAA,GACD,CAAA;AACH
|
|
1
|
+
{"version":3,"file":"githubIssuesCreate.cjs.js","sources":["../../src/actions/githubIssuesCreate.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 {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { InputError, toError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubIssuesCreate.examples';\n\n/**\n * Creates an issue on GitHub\n * @public\n */\nexport function createGithubIssuesCreateAction(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:issues:create',\n description: 'Creates an issue on GitHub.',\n examples,\n supportsDryRun: true,\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 repository name and `owner` is an organization or username',\n }),\n title: z =>\n z.string({\n description: 'The title of the issue',\n }),\n body: z =>\n z\n .string({\n description: 'The contents of the issue',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.string(), {\n description:\n 'Logins for Users to assign to this issue. NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise.',\n })\n .optional(),\n milestone: z =>\n z\n .union([z.string(), z.number()], {\n description:\n 'The number of the milestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.',\n })\n .optional(),\n labels: z =>\n z\n .array(z.string(), {\n description:\n 'Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.',\n })\n .optional(),\n token: z =>\n z\n .string({\n description:\n 'The `GITHUB_TOKEN` to use for authorization to GitHub',\n })\n .optional(),\n },\n output: {\n issueUrl: z =>\n z.string({\n description: 'The URL of the created issue',\n }),\n issueNumber: z =>\n z.number({\n description: 'The number of the created issue',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n title,\n body,\n assignees,\n milestone,\n labels,\n token: providedToken,\n } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n ctx.logger.info(`Creating issue \"${title}\" on repo ${repo}`);\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 host,\n owner,\n repo,\n token: providedToken,\n });\n\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n if (ctx.isDryRun) {\n ctx.logger.info(`Performing dry run of creating issue \"${title}\"`);\n ctx.output('issueUrl', `https://github.com/${owner}/${repo}/issues/42`);\n ctx.output('issueNumber', 42);\n ctx.logger.info(`Dry run complete`);\n return;\n }\n\n try {\n const issue = await ctx.checkpoint({\n key: `github.issues.create.${owner}.${repo}.${title}`,\n fn: async () => {\n const response = await client.rest.issues.create({\n owner,\n repo,\n title,\n body,\n assignees,\n milestone,\n labels,\n });\n\n return {\n html_url: response.data.html_url,\n number: response.data.number,\n };\n },\n });\n\n if (!issue) {\n throw new Error('Failed to create issue');\n }\n\n ctx.output('issueUrl', issue.html_url);\n ctx.output('issueNumber', issue.number);\n\n ctx.logger.info(\n `Successfully created issue #${issue.number}: ${issue.html_url}`,\n );\n } catch (e) {\n const error = toError(e);\n ctx.logger.warn(\n `Failed: creating issue '${title}' on repo: '${repo}', ${error.message}`,\n );\n throw error;\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","toError"],"mappings":";;;;;;;;AAiCO,SAAS,+BAA+B,OAAA,EAI5C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,sBAAA;AAAA,IACJ,WAAA,EAAa,6BAAA;AAAA,cACbC,oCAAA;AAAA,IACA,cAAA,EAAgB,IAAA;AAAA,IAChB,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,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,WAAW,CAAA,CAAA,KACT,CAAA,CACG,KAAA,CAAM,CAAA,CA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,EAAQ,SAAS,IAAA,CAAK;AAAA,aACxB;AAAA,UACF;AAAA,SACD,CAAA;AAED,QAAA,IAAI,CAAC,KAAA,EAAO;AACV,UAAA,MAAM,IAAI,MAAM,wBAAwB,CAAA;AAAA,QAC1C;AAEA,QAAA,GAAA,CAAI,MAAA,CAAO,UAAA,EAAY,KAAA,CAAM,QAAQ,CAAA;AACrC,QAAA,GAAA,CAAI,MAAA,CAAO,aAAA,EAAe,KAAA,CAAM,MAAM,CAAA;AAEtC,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,CAAA,4BAAA,EAA+B,KAAA,CAAM,MAAM,CAAA,EAAA,EAAK,MAAM,QAAQ,CAAA;AAAA,SAChE;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,MAAM,KAAA,GAAQC,eAAQ,CAAC,CAAA;AACvB,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,2BAA2B,KAAK,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,MAAM,OAAO,CAAA;AAAA,SACxE;AACA,QAAA,MAAM,KAAA;AAAA,MACR;AAAA,IACF;AAAA,GACD,CAAA;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubIssuesCreate.examples.cjs.js","sources":["../../src/actions/githubIssuesCreate.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a simple issue',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Bug report',\n body: 'Found a bug that needs to be fixed',\n },\n },\n ],\n }),\n },\n {\n description: 'Create an issue with labels and assignees',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue with metadata',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Feature request',\n body: 'This is a new feature request',\n labels: ['enhancement', 'needs-review'],\n assignees: ['octocat'],\n milestone: 1,\n },\n },\n ],\n }),\n },\n {\n description: 'Create an issue with specific token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue with token',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Documentation update',\n body: 'Update the documentation for the new API',\n labels: ['documentation'],\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,uBAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,cAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,YAAA;AAAA,YACP,IAAA,EAAM;AAAA;AACR;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,2CAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,4BAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,iBAAA;AAAA,YACP,IAAA,EAAM,+BAAA;AAAA,YACN,MAAA,EAAQ,CAAC,aAAA,EAAe,cAAc,CAAA;AAAA,YACtC,SAAA,EAAW,CAAC,SAAS,CAAA;AAAA,YACrB,SAAA,EAAW;AAAA;AACb;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,qCAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,yBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,sBAAA;AAAA,YACP,IAAA,EAAM,0CAAA;AAAA,YACN,MAAA,EAAQ,CAAC,eAAe,CAAA;AAAA,YACxB,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL
|
|
1
|
+
{"version":3,"file":"githubIssuesCreate.examples.cjs.js","sources":["../../src/actions/githubIssuesCreate.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a simple issue',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Bug report',\n body: 'Found a bug that needs to be fixed',\n },\n },\n ],\n }),\n },\n {\n description: 'Create an issue with labels and assignees',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue with metadata',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Feature request',\n body: 'This is a new feature request',\n labels: ['enhancement', 'needs-review'],\n assignees: ['octocat'],\n milestone: 1,\n },\n },\n ],\n }),\n },\n {\n description: 'Create an issue with specific token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:create',\n name: 'Create issue with token',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n title: 'Documentation update',\n body: 'Update the documentation for the new API',\n labels: ['documentation'],\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,uBAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,cAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,YAAA;AAAA,YACP,IAAA,EAAM;AAAA;AACR;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,2CAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,4BAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,iBAAA;AAAA,YACP,IAAA,EAAM,+BAAA;AAAA,YACN,MAAA,EAAQ,CAAC,aAAA,EAAe,cAAc,CAAA;AAAA,YACtC,SAAA,EAAW,CAAC,SAAS,CAAA;AAAA,YACrB,SAAA,EAAW;AAAA;AACb;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,qCAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,sBAAA;AAAA,UACR,IAAA,EAAM,yBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,KAAA,EAAO,sBAAA;AAAA,YACP,IAAA,EAAM,0CAAA;AAAA,YACN,MAAA,EAAQ,CAAC,eAAe,CAAA;AAAA,YACxB,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubIssuesLabel.cjs.js","sources":["../../src/actions/githubIssuesLabel.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 {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { InputError, toError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubIssuesLabel.examples';\n\n/**\n * Adds labels to a pull request or issue on GitHub\n * @public\n */\nexport function createGithubIssuesLabelAction(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:issues:label',\n description: 'Adds labels to a pull request or issue on GitHub.',\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 repository name and `owner` is an organization or username',\n }),\n number: z =>\n z.number({\n description: 'The pull request or issue number to add labels to',\n }),\n labels: z =>\n z.array(z.string(), {\n description: 'The labels to add to the pull request or issue',\n }),\n token: z =>\n z\n .string({\n description:\n 'The `GITHUB_TOKEN` to use for authorization to GitHub',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const { repoUrl, number, labels, token: providedToken } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n ctx.logger.info(`Adding labels to ${number} issue on repo ${repo}`);\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 host,\n owner,\n repo,\n token: providedToken,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n try {\n await ctx.checkpoint({\n key: `github.issues.add.label.${owner}.${repo}.${number}`,\n fn: async () => {\n await client.rest.issues.addLabels({\n owner,\n repo,\n issue_number: number,\n labels,\n });\n },\n });\n } catch (e) {\n ctx.logger.warn(\n `Failed: adding labels to issue: '${number}' on repo: '${repo}', ${\n toError(e).message\n }`,\n );\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","toError"],"mappings":";;;;;;;;AAiCO,SAAS,8BAA8B,OAAA,EAI3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,qBAAA;AAAA,IACJ,WAAA,EAAa,mDAAA;AAAA,cACbC,mCAAA;AAAA,IACA,MAAA,EAAQ;A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,OACV,CAAA;AAED,MAAA,IAAI;AACF,QAAA,MAAM,IAAI,UAAA,CAAW;AAAA,UACnB,KAAK,CAAA,wBAAA,EAA2B,KAAK,CAAA,CAAA,EAAI,IAAI,IAAI,MAAM,CAAA,CAAA;AAAA,UACvD,IAAI,YAAY;AACd,YAAA,MAAM,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU;AAAA,cACjC,KAAA;AAAA,cACA,IAAA;AAAA,cACA,YAAA,EAAc,MAAA;AAAA,cACd;AAAA,aACD,CAAA;AAAA,UACH;AAAA,SACD,CAAA;AAAA,MACH,SAAS,CAAA,EAAG;AACV,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,CAAA,iCAAA,EAAoC,MAAM,CAAA,YAAA,EAAe,IAAI,MAC3DC,cAAA,CAAQ,CAAC,EAAE,OACb,CAAA;AAAA,SACF;AAAA,MACF;AAAA,IACF;AAAA,GACD,CAAA;AACH
|
|
1
|
+
{"version":3,"file":"githubIssuesLabel.cjs.js","sources":["../../src/actions/githubIssuesLabel.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 {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { InputError, toError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubIssuesLabel.examples';\n\n/**\n * Adds labels to a pull request or issue on GitHub\n * @public\n */\nexport function createGithubIssuesLabelAction(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:issues:label',\n description: 'Adds labels to a pull request or issue on GitHub.',\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 repository name and `owner` is an organization or username',\n }),\n number: z =>\n z.number({\n description: 'The pull request or issue number to add labels to',\n }),\n labels: z =>\n z.array(z.string(), {\n description: 'The labels to add to the pull request or issue',\n }),\n token: z =>\n z\n .string({\n description:\n 'The `GITHUB_TOKEN` to use for authorization to GitHub',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const { repoUrl, number, labels, token: providedToken } = ctx.input;\n\n const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);\n ctx.logger.info(`Adding labels to ${number} issue on repo ${repo}`);\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 host,\n owner,\n repo,\n token: providedToken,\n });\n const client = new Octokit({\n ...octokitOptions,\n log: ctx.logger,\n });\n\n try {\n await ctx.checkpoint({\n key: `github.issues.add.label.${owner}.${repo}.${number}`,\n fn: async () => {\n await client.rest.issues.addLabels({\n owner,\n repo,\n issue_number: number,\n labels,\n });\n },\n });\n } catch (e) {\n ctx.logger.warn(\n `Failed: adding labels to issue: '${number}' on repo: '${repo}', ${\n toError(e).message\n }`,\n );\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit","toError"],"mappings":";;;;;;;;AAiCO,SAAS,8BAA8B,OAAA,EAI3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,E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AAA,EAAO;AAAA,OACR,CAAA;AACD,MAAA,MAAM,MAAA,GAAS,IAAIC,eAAA,CAAQ;AAAA,QACzB,GAAG,cAAA;AAAA,QACH,KAAK,GAAA,CAAI;AAAA,OACV,CAAA;AAED,MAAA,IAAI;AACF,QAAA,MAAM,IAAI,UAAA,CAAW;AAAA,UACnB,KAAK,CAAA,wBAAA,EAA2B,KAAK,CAAA,CAAA,EAAI,IAAI,IAAI,MAAM,CAAA,CAAA;AAAA,UACvD,IAAI,YAAY;AACd,YAAA,MAAM,MAAA,CAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU;AAAA,cACjC,KAAA;AAAA,cACA,IAAA;AAAA,cACA,YAAA,EAAc,MAAA;AAAA,cACd;AAAA,aACD,CAAA;AAAA,UACH;AAAA,SACD,CAAA;AAAA,MACH,SAAS,CAAA,EAAG;AACV,QAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,UACT,CAAA,iCAAA,EAAoC,MAAM,CAAA,YAAA,EAAe,IAAI,MAC3DC,cAAA,CAAQ,CAAC,EAAE,OACb,CAAA;AAAA,SACF;AAAA,MACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubIssuesLabel.examples.cjs.js","sources":["../../src/actions/githubIssuesLabel.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Add labels to pull request or issue',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:label',\n name: 'Add labels to pull request or issue',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n number: '1',\n labels: ['bug'],\n },\n },\n ],\n }),\n },\n {\n description: 'Add labels to pull request or issue with specific token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:label',\n name: 'Add labels to pull request or issue with token',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n number: '1',\n labels: ['bug', 'documentation'],\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,qCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,qBAAA;AAAA,UACR,IAAA,EAAM,qCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,MAAA,EAAQ,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAK;AAAA;AAChB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,yDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,qBAAA;AAAA,UACR,IAAA,EAAM,gDAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,MAAA,EAAQ,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAA,EAAO,eAAe,CAAA;AAAA,YAC/B,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL
|
|
1
|
+
{"version":3,"file":"githubIssuesLabel.examples.cjs.js","sources":["../../src/actions/githubIssuesLabel.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Add labels to pull request or issue',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:label',\n name: 'Add labels to pull request or issue',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n number: '1',\n labels: ['bug'],\n },\n },\n ],\n }),\n },\n {\n description: 'Add labels to pull request or issue with specific token',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:issues:label',\n name: 'Add labels to pull request or issue with token',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n number: '1',\n labels: ['bug', 'documentation'],\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,qCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,qBAAA;AAAA,UACR,IAAA,EAAM,qCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,MAAA,EAAQ,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAK;AAAA;AAChB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,yDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,qBAAA;AAAA,UACR,IAAA,EAAM,gDAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,MAAA,EAAQ,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAA,EAAO,eAAe,CAAA;AAAA,YAC/B,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubPagesEnable.cjs.js","sources":["../../src/actions/githubPagesEnable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { examples } from './githubPagesEnable.examples';\nimport { getOctokitOptions } from '../util';\n\n/**\n * Creates a new action that enables GitHub Pages for a repository.\n *\n * @public\n */\nexport function createGithubPagesEnableAction(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:pages:enable',\n examples,\n description: 'Enables GitHub Pages for a repository.',\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 buildType: z =>\n z\n .enum(['legacy', 'workflow'], {\n description:\n 'The GitHub Pages build type - `legacy` or `workflow`. Default is `workflow`',\n })\n .default('workflow')\n .optional(),\n sourceBranch: z =>\n z\n .string({\n description: 'The GitHub Pages source branch. Default is \"main\"',\n })\n .default('main')\n .optional(),\n sourcePath: z =>\n z\n .enum(['/', '/docs'], {\n description:\n 'The GitHub Pages source path - \"/\" or \"/docs\". Default is \"/\"',\n })\n .default('/')\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n buildType = 'workflow',\n sourceBranch = 'main',\n sourcePath = '/',\n token: providedToken,\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 ctx.logger.info(\n `Attempting to enable GitHub Pages for ${owner}/${repo} with \"${buildType}\" build type, on source branch \"${sourceBranch}\" and source path \"${sourcePath}\"`,\n );\n\n await ctx.checkpoint({\n key: `enabled.github.pages.${owner}.${repo}`,\n fn: async () => {\n await client.request('POST /repos/{owner}/{repo}/pages', {\n owner: owner,\n repo: repo,\n build_type: buildType,\n source: {\n branch: sourceBranch,\n path: sourcePath,\n },\n headers: {\n 'X-GitHub-Api-Version': '2022-11-28',\n },\n });\n },\n });\n\n ctx.logger.info('Completed enabling GitHub Pages');\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit"],"mappings":";;;;;;;;AAkCO,SAAS,8BAA8B,OAAA,EAI3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAA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AIC,kBAAW,8CAA8C,CAAA;AAAA,MACrE;AAEA,MAAA,MAAM,cAAA,GAAiB,MAAMC,sBAAA,CAAkB;AAAA,QAC7C,YAAA;AAAA,QACA,yBAAA;AAAA,QACA,mBAAA,EAAqB,yBAAA;AAAA,QACrB,KAAA,EAAO,aAAA;AAAA,QACP,IAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OACD,CAAA;AACD,MAAA,MAAM,MAAA,GAAS,IAAIC,eAAA,CAAQ;AAAA,QACzB,GAAG,cAAA;AAAA,QACH,KAAK,GAAA,CAAI;AAAA,OACV,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,IAAA;AAAA,QACT,CAAA,sCAAA,EAAyC,KAAK,CAAA,CAAA,EAAI,IAAI,UAAU,SAAS,CAAA,gCAAA,EAAmC,YAAY,CAAA,mBAAA,EAAsB,UAAU,CAAA,CAAA;AAAA,OAC1J;AAEA,MAAA,MAAM,IAAI,UAAA,CAAW;AAAA,QACnB,GAAA,EAAK,CAAA,qBAAA,EAAwB,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QAC1C,IAAI,YAAY;AACd,UAAA,MAAM,MAAA,CAAO,QAAQ,kCAAA,EAAoC;AAAA,YACvD,KAAA;AAAA,YACA,IAAA;AAAA,YACA,UAAA,EAAY,SAAA;AAAA,YACZ,MAAA,EAAQ;AAAA,cACN,MAAA,EAAQ,YAAA;AAAA,cACR,IAAA,EAAM;AAAA,aACR;AAAA,YACA,OAAA,EAAS;AAAA,cACP,sBAAA,EAAwB;AAAA;AAC1B,WACD,CAAA;AAAA,QACH;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,KAAK,iCAAiC,CAAA;AAAA,IACnD;AAAA,GACD,CAAA;AACH
|
|
1
|
+
{"version":3,"file":"githubPagesEnable.cjs.js","sources":["../../src/actions/githubPagesEnable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { examples } from './githubPagesEnable.examples';\nimport { getOctokitOptions } from '../util';\n\n/**\n * Creates a new action that enables GitHub Pages for a repository.\n *\n * @public\n */\nexport function createGithubPagesEnableAction(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:pages:enable',\n examples,\n description: 'Enables GitHub Pages for a repository.',\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 buildType: z =>\n z\n .enum(['legacy', 'workflow'], {\n description:\n 'The GitHub Pages build type - `legacy` or `workflow`. Default is `workflow`',\n })\n .default('workflow')\n .optional(),\n sourceBranch: z =>\n z\n .string({\n description: 'The GitHub Pages source branch. Default is \"main\"',\n })\n .default('main')\n .optional(),\n sourcePath: z =>\n z\n .enum(['/', '/docs'], {\n description:\n 'The GitHub Pages source path - \"/\" or \"/docs\". Default is \"/\"',\n })\n .default('/')\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n buildType = 'workflow',\n sourceBranch = 'main',\n sourcePath = '/',\n token: providedToken,\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 ctx.logger.info(\n `Attempting to enable GitHub Pages for ${owner}/${repo} with \"${buildType}\" build type, on source branch \"${sourceBranch}\" and source path \"${sourcePath}\"`,\n );\n\n await ctx.checkpoint({\n key: `enabled.github.pages.${owner}.${repo}`,\n fn: async () => {\n await client.request('POST /repos/{owner}/{repo}/pages', {\n owner: owner,\n repo: repo,\n build_type: buildType,\n source: {\n branch: sourceBranch,\n path: sourcePath,\n },\n headers: {\n 'X-GitHub-Api-Version': '2022-11-28',\n },\n });\n },\n });\n\n ctx.logger.info('Completed enabling GitHub Pages');\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","getOctokitOptions","Octokit"],"mappings":";;;;;;;;AAkCO,SAAS,8BAA8B,OAAA,EAI3C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,qBAAA;AAAA,cACJC,mCAAA;AAAA,IACA,WAAA,EAAa,wCAAA;AAAA,IACb,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,WAAW,CAAA,CAAA,KACT,CAAA,CACG,KAAK,CAAC,QAAA,EAAU,UAAU,CAAA,EAAG;AAAA,UAC5B,WAAA,EACE;AAAA,SACH,CAAA,CACA,OAAA,CAAQ,UAAU,EA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T,CAAA,sCAAA,EAAyC,KAAK,CAAA,CAAA,EAAI,IAAI,UAAU,SAAS,CAAA,gCAAA,EAAmC,YAAY,CAAA,mBAAA,EAAsB,UAAU,CAAA,CAAA;AAAA,OAC1J;AAEA,MAAA,MAAM,IAAI,UAAA,CAAW;AAAA,QACnB,GAAA,EAAK,CAAA,qBAAA,EAAwB,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QAC1C,IAAI,YAAY;AACd,UAAA,MAAM,MAAA,CAAO,QAAQ,kCAAA,EAAoC;AAAA,YACvD,KAAA;AAAA,YACA,IAAA;AAAA,YACA,UAAA,EAAY,SAAA;AAAA,YACZ,MAAA,EAAQ;AAAA,cACN,MAAA,EAAQ,YAAA;AAAA,cACR,IAAA,EAAM;AAAA,aACR;AAAA,YACA,OAAA,EAAS;AAAA,cACP,sBAAA,EAAwB;AAAA;AAC1B,WACD,CAAA;AAAA,QACH;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,KAAK,iCAAiC,CAAA;AAAA,IACnD;AAAA,GACD,CAAA;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubPagesEnable.examples.cjs.js","sources":["../../src/actions/githubPagesEnable.examples.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Enables GitHub Pages for a repository.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages',\n name: 'Enable GitHub Pages',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom source path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-path',\n name: 'Enable GitHub Pages with Custom Source Path',\n input: {\n repoUrl: 'github.com?repo=customPathRepo&owner=customOwner',\n sourcePath: '/docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository using legacy build type.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-legacy',\n name: 'Enable GitHub Pages with Legacy Build Type',\n input: {\n repoUrl: 'github.com?repo=legacyRepo&owner=legacyOwner',\n buildType: 'legacy',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom source branch.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-branch',\n name: 'Enable GitHub Pages with Custom Source Branch',\n input: {\n repoUrl: 'github.com?repo=customBranchRepo&owner=branchOwner',\n sourceBranch: 'develop',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n\n {\n description:\n 'Enables GitHub Pages for a repository with full customization.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-full-custom',\n name: 'Enable GitHub Pages with Full Customization',\n input: {\n repoUrl: 'github.com?repo=fullCustomRepo&owner=customOwner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with minimal configuration.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-minimal',\n name: 'Enable GitHub Pages with Minimal Configuration',\n input: {\n repoUrl: 'github.com?repo=minimalRepo&owner=minimalOwner',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with custom build type and source path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-build-path',\n name: 'Enable GitHub Pages with Custom Build Type and Source Path',\n input: {\n repoUrl: 'github.com?repo=customBuildPathRepo&owner=customOwner',\n buildType: 'legacy',\n sourcePath: '/custom-path',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with custom source branch and path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-branch-path',\n name: 'Enable GitHub Pages with Custom Source Branch and Path',\n input: {\n repoUrl:\n 'github.com?repo=customBranchPathRepo&owner=branchPathOwner',\n sourceBranch: 'feature-branch',\n sourcePath: '/project-docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom owner and repository name.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-owner-repo',\n name: 'Enable GitHub Pages with Custom Owner and Repository Name',\n input: {\n repoUrl: 'github.com?repo=customRepoName&owner=customOwnerName',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with full customization and a different token.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-full-custom-diff-token',\n name: 'Enable GitHub Pages with Full Customization and Different Token',\n input: {\n repoUrl: 'github.com?repo=customTokenRepo&owner=tokenOwner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/site',\n token: 'gph_DifferentGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a specific token for authorization.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-specific-token',\n name: 'Enable GitHub Pages with Specific Token',\n input: {\n repoUrl: 'github.com?repo=specificTokenRepo&owner=tokenOwner',\n token: 'gph_SpecificGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a documentation site with custom configuration.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-doc-site',\n name: 'Enable GitHub Pages for Documentation Site',\n input: {\n repoUrl: 'github.com?repo=docSiteRepo&owner=docsOwner',\n buildType: 'workflow',\n sourceBranch: 'docs-branch',\n sourcePath: '/docs-site',\n token: 'gph_DocsGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,wCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,cAAA;AAAA,UACR,EAAA,EAAI,cAAA;AAAA,UACJ,IAAA,EAAM,qBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,SAAA,EAAW,UAAA;AAAA,YACX,YAAA,EAAc,MAAA;AAAA,YACd,UAAA,EAAY,GAAA;AAAA,YACZ,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,kEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,cAAA;AAAA,UACR,EAAA,EAAI,0BAAA;AAAA,UACJ,IAAA,EAAM,6CAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kDAAA;AAAA,YACT,UAAA,EAAY,OAAA;AAAA,YACZ,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA,GACH;AAAA,E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/actions/githubPagesEnable.examples.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Enables GitHub Pages for a repository.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages',\n name: 'Enable GitHub Pages',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom source path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-path',\n name: 'Enable GitHub Pages with Custom Source Path',\n input: {\n repoUrl: 'github.com?repo=customPathRepo&owner=customOwner',\n sourcePath: '/docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository using legacy build type.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-legacy',\n name: 'Enable GitHub Pages with Legacy Build Type',\n input: {\n repoUrl: 'github.com?repo=legacyRepo&owner=legacyOwner',\n buildType: 'legacy',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom source branch.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-branch',\n name: 'Enable GitHub Pages with Custom Source Branch',\n input: {\n repoUrl: 'github.com?repo=customBranchRepo&owner=branchOwner',\n sourceBranch: 'develop',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n\n {\n description:\n 'Enables GitHub Pages for a repository with full customization.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-full-custom',\n name: 'Enable GitHub Pages with Full Customization',\n input: {\n repoUrl: 'github.com?repo=fullCustomRepo&owner=customOwner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with minimal configuration.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-minimal',\n name: 'Enable GitHub Pages with Minimal Configuration',\n input: {\n repoUrl: 'github.com?repo=minimalRepo&owner=minimalOwner',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with custom build type and source path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-build-path',\n name: 'Enable GitHub Pages with Custom Build Type and Source Path',\n input: {\n repoUrl: 'github.com?repo=customBuildPathRepo&owner=customOwner',\n buildType: 'legacy',\n sourcePath: '/custom-path',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with custom source branch and path.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-branch-path',\n name: 'Enable GitHub Pages with Custom Source Branch and Path',\n input: {\n repoUrl:\n 'github.com?repo=customBranchPathRepo&owner=branchPathOwner',\n sourceBranch: 'feature-branch',\n sourcePath: '/project-docs',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a custom owner and repository name.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-custom-owner-repo',\n name: 'Enable GitHub Pages with Custom Owner and Repository Name',\n input: {\n repoUrl: 'github.com?repo=customRepoName&owner=customOwnerName',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with full customization and a different token.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-full-custom-diff-token',\n name: 'Enable GitHub Pages with Full Customization and Different Token',\n input: {\n repoUrl: 'github.com?repo=customTokenRepo&owner=tokenOwner',\n buildType: 'workflow',\n sourceBranch: 'main',\n sourcePath: '/site',\n token: 'gph_DifferentGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a repository with a specific token for authorization.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-specific-token',\n name: 'Enable GitHub Pages with Specific Token',\n input: {\n repoUrl: 'github.com?repo=specificTokenRepo&owner=tokenOwner',\n token: 'gph_SpecificGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Enables GitHub Pages for a documentation site with custom configuration.',\n example: yaml.stringify({\n steps: [\n {\n action: 'github:pages',\n id: 'github-pages-doc-site',\n name: 'Enable GitHub Pages for Documentation Site',\n input: {\n repoUrl: 'github.com?repo=docSiteRepo&owner=docsOwner',\n buildType: 'workflow',\n sourceBranch: 'docs-branch',\n sourcePath: '/docs-site',\n token: 'gph_DocsGitHubToken',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,wCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,cAAA;AAAA,UACR,EAAA,EAAI,cAAA;AAAA,UACJ,IAAA,EAAM,qBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,SAAA,EAAW,UAAA;AAAA,Y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AA,EACA;AAAA,IACE,WAAA,EACE,0EAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,cAAA;AAAA,UACR,EAAA,EAAI,uBAAA;AAAA,UACJ,IAAA,EAAM,4CAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,6CAAA;AAAA,YACT,SAAA,EAAW,UAAA;AAAA,YACX,YAAA,EAAc,aAAA;AAAA,YACd,UAAA,EAAY,YAAA;AAAA,YACZ,KAAA,EAAO;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubPullRequest.cjs.js","sources":["../../src/actions/githubPullRequest.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 path from 'node:path';\nimport {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n SerializedFile,\n serializeDirectoryContents,\n} from '@backstage/plugin-scaffolder-node';\nimport { Octokit } from 'octokit';\nimport { CustomErrorBase, InputError } from '@backstage/errors';\nimport {\n createPullRequest,\n DELETE_FILE,\n} from 'octokit-plugin-create-pull-request';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubPullRequest.examples';\nimport {\n LoggerService,\n resolveSafeChildPath,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { JsonValue } from '@backstage/types';\n\nexport type Encoding = 'utf-8' | 'base64';\n\nclass GithubResponseError extends CustomErrorBase {}\n\nexport const defaultClientFactory: CreateGithubPullRequestActionOptions['clientFactory'] =\n async ({\n integrations,\n githubCredentialsProvider,\n owner,\n repo,\n host = 'github.com',\n token: providedToken,\n }) => {\n const octokitOptions = await getOctokitOptions({\n integrations,\n credentialsProvider: githubCredentialsProvider,\n host,\n owner,\n repo,\n token: providedToken,\n });\n\n const OctokitPR = Octokit.plugin(createPullRequest);\n return new OctokitPR({\n ...octokitOptions,\n ...{ throttle: { enabled: false } },\n });\n };\n\n/**\n * The options passed to {@link createPublishGithubPullRequestAction} method\n * @public\n */\nexport interface CreateGithubPullRequestActionOptions {\n /**\n * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.\n */\n integrations: ScmIntegrationRegistry;\n /**\n * An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.\n */\n githubCredentialsProvider?: GithubCredentialsProvider;\n /**\n * Whether this action must use credentials provided through its input.\n */\n requireScmUserCredentials?: boolean;\n /**\n * A method to return the Octokit client with the Pull Request Plugin.\n */\n clientFactory?: (input: {\n integrations: ScmIntegrationRegistry;\n githubCredentialsProvider?: GithubCredentialsProvider;\n host: string;\n owner: string;\n repo: string;\n token?: string;\n }) => Promise<\n Octokit & {\n createPullRequest(options: createPullRequest.Options): Promise<{\n data: {\n html_url: string;\n number: number;\n base: {\n ref: string;\n };\n };\n } | null>;\n }\n >;\n /**\n * An instance of {@link @backstage/config#Config} that will be used in the action.\n */\n config?: Config;\n}\n\ntype GithubPullRequest = {\n owner: string;\n repo: string;\n number: number;\n};\n\n/**\n * Creates a Github Pull Request action.\n * @public\n */\nexport const createPublishGithubPullRequestAction = (\n options: CreateGithubPullRequestActionOptions,\n) => {\n const {\n integrations,\n githubCredentialsProvider,\n clientFactory = defaultClientFactory,\n config,\n requireScmUserCredentials,\n } = options;\n\n return createTemplateAction({\n id: 'publish:github:pull-request',\n examples,\n supportsDryRun: true,\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 repository name and `owner` is an organization or username',\n }),\n branchName: z =>\n z.string({\n description: 'The name for the branch',\n }),\n filesToDelete: z =>\n z\n .array(z.string(), {\n description: 'List of files that will be deleted',\n })\n .optional(),\n targetBranchName: z =>\n z\n .string({\n description: 'The target branch name of the pull request',\n })\n .optional(),\n title: z =>\n z.string({\n description: 'The name for the pull request',\n }),\n description: z =>\n z.string({\n description: 'The description of the pull request',\n }),\n draft: z =>\n z\n .boolean({\n description: 'Create a draft pull request',\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description:\n 'Subdirectory of working directory to copy changes from',\n })\n .optional(),\n targetPath: z =>\n z\n .string({\n description: 'Subdirectory of repository to apply changes to',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n reviewers: z =>\n z\n .array(z.string(), {\n description:\n 'The users that will be added as reviewers to the pull request',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.string(), {\n description:\n 'The users that will be added as assignees to the pull request',\n })\n .optional(),\n teamReviewers: z =>\n z\n .array(z.string(), {\n description:\n 'The teams that will be added as reviewers to the pull request',\n })\n .optional(),\n commitMessage: z =>\n z\n .string({\n description: 'The commit message for the pull request commit',\n })\n .optional(),\n update: z =>\n z\n .boolean({\n description: 'Update pull request if already exists',\n })\n .optional(),\n forceFork: z =>\n z\n .boolean({\n description: 'Create pull request from a fork',\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description:\n 'Sets the default author name for the commit. The default value is the authenticated user or `Scaffolder`',\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description:\n 'Sets the default author email for the commit. The default value is the authenticated user or `scaffolder@backstage.io`',\n })\n .optional(),\n forceEmptyGitAuthor: z =>\n z\n .boolean({\n description:\n 'Forces the author to be empty. This is useful when using a Github App, it permit the commit to be verified on Github',\n })\n .optional(),\n createWhenEmpty: z =>\n z\n .boolean({\n description:\n 'Set whether to create pull request when there are no changes to commit. The default value is true. If set to false, remoteUrl is no longer a required output.',\n })\n .optional(),\n },\n output: {\n targetBranchName: z =>\n z.string({\n description: 'Target branch name of the merge request',\n }),\n remoteUrl: z =>\n z.string({\n description: 'Link to the pull request in Github',\n }),\n pullRequestNumber: z =>\n z.number({\n description: 'The pull request number',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n branchName,\n filesToDelete,\n targetBranchName,\n title,\n description,\n draft,\n targetPath,\n sourcePath,\n token: providedToken,\n reviewers,\n assignees,\n teamReviewers,\n commitMessage,\n update,\n forceFork,\n gitAuthorEmail,\n gitAuthorName,\n forceEmptyGitAuthor,\n createWhenEmpty,\n } = ctx.input;\n\n const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(\n `No owner provided for host: ${host}, and repo ${repo}`,\n );\n }\n\n if (requireScmUserCredentials && !providedToken) {\n throw new InputError(\n `No user credentials provided for host ${host}, but scaffolder.requireScmUserCredentials is enabled`,\n );\n }\n\n const client = await clientFactory({\n integrations,\n githubCredentialsProvider,\n host,\n owner,\n repo,\n token: providedToken,\n });\n\n const fileRoot = sourcePath\n ? resolveSafeChildPath(ctx.workspacePath, sourcePath)\n : ctx.workspacePath;\n\n const directoryContents = await serializeDirectoryContents(fileRoot, {\n gitignore: true,\n });\n\n const determineFileMode = (file: SerializedFile): string => {\n if (file.symlink) return '120000';\n if (file.executable) return '100755';\n return '100644';\n };\n\n const determineFileEncoding = (\n file: SerializedFile,\n ): 'utf-8' | 'base64' => (file.symlink ? 'utf-8' : 'base64');\n\n const files = Object.fromEntries([\n ...directoryContents.map(file => [\n targetPath ? path.posix.join(targetPath, file.path) : file.path,\n {\n // See the properties of tree items\n // in https://docs.github.com/en/rest/reference/git#trees\n mode: determineFileMode(file),\n // Always use base64 encoding where possible to avoid doubling a binary file in size\n // due to interpreting a binary file as utf-8 and sending github\n // the utf-8 encoded content. Symlinks are kept as utf-8 to avoid them\n // being formatted as a series of scrambled characters\n //\n // For example, the original gradle-wrapper.jar is 57.8k in https://github.com/kennethzfeng/pull-request-test/pull/5/files.\n // Its size could be doubled to 98.3K (See https://github.com/kennethzfeng/pull-request-test/pull/4/files)\n encoding: determineFileEncoding(file),\n content: file.content.toString(determineFileEncoding(file)),\n },\n ]),\n // order of arrays is important so filesToDelete will overwrite\n // changes from files above\n ...(filesToDelete || []).map(filePath => [\n targetPath ? path.posix.join(targetPath, filePath) : filePath,\n DELETE_FILE,\n ]),\n ]);\n\n // If this is a dry run, log and return\n if (ctx.isDryRun) {\n ctx.logger.info(`Performing dry run of creating pull request`);\n ctx.output('targetBranchName', branchName);\n ctx.output('remoteUrl', repoUrl);\n ctx.output('pullRequestNumber', 43);\n ctx.logger.info(`Dry run complete`);\n return;\n }\n\n try {\n const createOptions: createPullRequest.Options = {\n owner,\n repo,\n title,\n changes: [\n {\n files,\n commit:\n commitMessage ??\n config?.getOptionalString('scaffolder.defaultCommitMessage') ??\n title,\n },\n ],\n body: description,\n head: branchName,\n draft,\n update,\n forceFork,\n createWhenEmpty,\n };\n\n const gitAuthorInfo = {\n name:\n gitAuthorName ??\n config?.getOptionalString('scaffolder.defaultAuthor.name'),\n email:\n gitAuthorEmail ??\n config?.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n if (!forceEmptyGitAuthor) {\n if (gitAuthorInfo.name || gitAuthorInfo.email) {\n if (Array.isArray(createOptions.changes)) {\n createOptions.changes = createOptions.changes.map(change => ({\n ...change,\n author: {\n name: gitAuthorInfo.name || 'Scaffolder',\n email: gitAuthorInfo.email || 'scaffolder@backstage.io',\n },\n }));\n } else {\n createOptions.changes = {\n ...createOptions.changes,\n author: {\n name: gitAuthorInfo.name || 'Scaffolder',\n email: gitAuthorInfo.email || 'scaffolder@backstage.io',\n },\n };\n }\n }\n }\n\n if (targetBranchName) {\n createOptions.base = targetBranchName;\n }\n\n const pr = await ctx.checkpoint({\n key: `create.pr.${owner}.${repo}.${branchName}`,\n fn: async () => {\n const response = await client.createPullRequest(createOptions);\n if (!response) {\n return null;\n }\n\n return {\n base: response?.data.base,\n html_url: response?.data.html_url,\n number: response?.data.number,\n };\n },\n });\n\n if (createWhenEmpty === false && !pr) {\n ctx.logger.info('No changes to commit, pull request was not created');\n return;\n }\n\n if (!pr) {\n throw new GithubResponseError('null response from Github');\n }\n\n const pullRequestNumber = pr.number;\n const pullRequest = { owner, repo, number: pullRequestNumber };\n if (reviewers || teamReviewers) {\n await requestReviewersOnPullRequest(\n pullRequest,\n reviewers,\n teamReviewers,\n client,\n ctx.logger,\n ctx.checkpoint,\n );\n }\n\n if (assignees) {\n if (assignees.length > 10) {\n ctx.logger.warn(\n 'Assignees list is too long, only the first 10 will be used.',\n );\n }\n await addAssigneesToPullRequest(\n pullRequest,\n assignees,\n client,\n ctx.logger,\n ctx.checkpoint,\n );\n }\n\n const targetBranch = pr.base.ref;\n ctx.output('targetBranchName', targetBranch);\n ctx.output('remoteUrl', pr.html_url);\n ctx.output('pullRequestNumber', pullRequestNumber);\n } catch (e) {\n throw new GithubResponseError('Pull request creation failed', e);\n }\n },\n });\n\n async function addAssigneesToPullRequest(\n pr: GithubPullRequest,\n assignees: string[],\n client: Octokit,\n logger: LoggerService,\n checkpoint: <T extends JsonValue | void>(opts: {\n key: string;\n fn: () => Promise<T> | T;\n }) => Promise<T>,\n ) {\n try {\n await checkpoint({\n key: `add.assignees.${pr.owner}.${pr.repo}.${pr.number}`,\n fn: async () => {\n const result = await client.rest.issues.addAssignees({\n owner: pr.owner,\n repo: pr.repo,\n issue_number: pr.number,\n assignees,\n });\n\n const addedAssignees = result.data.assignees?.join(', ') ?? '';\n\n logger.info(\n `Added assignees [${addedAssignees}] to Pull request ${pr.number}`,\n );\n },\n });\n } catch (e) {\n logger.error(\n `Failure when adding assignees to Pull request ${pr.number}`,\n e,\n );\n }\n }\n\n async function requestReviewersOnPullRequest(\n pr: GithubPullRequest,\n reviewers: string[] | undefined,\n teamReviewers: string[] | undefined,\n client: Octokit,\n logger: LoggerService,\n checkpoint: <T extends JsonValue | void>(opts: {\n key: string;\n fn: () => Promise<T> | T;\n }) => Promise<T>,\n ) {\n try {\n await checkpoint({\n key: `request.reviewers.${pr.owner}.${pr.repo}.${pr.number}`,\n fn: async () => {\n const result = await client.rest.pulls.requestReviewers({\n owner: pr.owner,\n repo: pr.repo,\n pull_number: pr.number,\n reviewers,\n team_reviewers: teamReviewers\n ? [...new Set(teamReviewers)]\n : undefined,\n });\n\n const addedUsers = result.data.requested_reviewers?.join(', ') ?? '';\n const addedTeams = result.data.requested_teams?.join(', ') ?? '';\n\n logger.info(\n `Added users [${addedUsers}] and teams [${addedTeams}] as reviewers to Pull request ${pr.number}`,\n );\n },\n });\n } catch (e) {\n logger.error(\n `Failure when adding reviewers to Pull request ${pr.number}`,\n e,\n );\n }\n }\n};\n"],"names":["CustomErrorBase","getOctokitOptions","Octokit","createPullRequest","createTemplateAction","examples","parseRepoUrl","InputError","resolveSafeChildPath","serializeDirectoryContents","path","DELETE_FILE"],"mappings":";;;;;;;;;;;;;;;AA4CA,MAAM,4BAA4BA,sBAAA,CAAgB;AAAC;AAE5C,MAAM,uBACX,OAAO;AAAA,EACL,YAAA;AAAA,EACA,yBAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA,GAAO,YAAA;AAAA,EACP,KAAA,EAAO;AACT,CAAA,KAAM;AACJ,EAAA,MAAM,cAAA,GAAiB,MAAMC,sBAAA,CAAkB;AAAA,IAC7C,YAAA;AAAA,IACA,mBAAA,EAAqB,yBAAA;AAAA,IACrB,IAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA,EAAO;AAAA,GACR,CAAA;AAED,EAAA,MAAM,SAAA,GAAYC,eAAA,CAAQ,MAAA,CAAOC,gDAAiB,CAAA;AAClD,EAAA,OAAO,IAAI,SAAA,CAAU;AAAA,IACnB,GAAG,cAAA;AAAA,IACH,GAAG,EAAE,QAAA,E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AAA,EAAI,EAAA,CAAG,MAAM,CAAA,CAAA;AAAA,QAC1D,IAAI,YAAY;AACd,UAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,IAAA,CAAK,MAAM,gBAAA,CAAiB;AAAA,YACtD,OAAO,EAAA,CAAG,KAAA;AAAA,YACV,MAAM,EAAA,CAAG,IAAA;AAAA,YACT,aAAa,EAAA,CAAG,MAAA;AAAA,YAChB,SAAA;AAAA,YACA,cAAA,EAAgB,gBACZ,CAAC,GAAG,IAAI,GAAA,CAAI,aAAa,CAAC,CAAA,GAC1B,KAAA;AAAA,WACL,CAAA;AAED,UAAA,MAAM,aAAa,MAAA,CAAO,IAAA,CAAK,mBAAA,EAAqB,IAAA,CAAK,IAAI,CAAA,IAAK,EAAA;AAClE,UAAA,MAAM,aAAa,MAAA,CAAO,IAAA,CAAK,eAAA,EAAiB,IAAA,CAAK,IAAI,CAAA,IAAK,EAAA;AAE9D,UAAA,MAAA,CAAO,IAAA;AAAA,YACL,gBAAgB,UAAU,CAAA,aAAA,EAAgB,UAAU,CAAA,+BAAA,EAAkC,GAAG,MAAM,CAAA;AAAA,WACjG;AAAA,QACF;AAAA,OACD,CAAA;AAAA,IACH,SAAS,CAAA,EAAG;AACV,MAAA,MAAA,CAAO,KAAA;AAAA,QACL,CAAA,8CAAA,EAAiD,GAAG,MAAM,CAAA,CAAA;AAAA,QAC1D;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF;;;;;"}
|
|
1
|
+
{"version":3,"file":"githubPullRequest.cjs.js","sources":["../../src/actions/githubPullRequest.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 path from 'node:path';\nimport {\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n parseRepoUrl,\n SerializedFile,\n serializeDirectoryContents,\n} from '@backstage/plugin-scaffolder-node';\nimport { Octokit } from 'octokit';\nimport { CustomErrorBase, InputError } from '@backstage/errors';\nimport {\n createPullRequest,\n DELETE_FILE,\n} from 'octokit-plugin-create-pull-request';\nimport { getOctokitOptions } from '../util';\nimport { examples } from './githubPullRequest.examples';\nimport {\n LoggerService,\n resolveSafeChildPath,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { JsonValue } from '@backstage/types';\n\nexport type Encoding = 'utf-8' | 'base64';\n\nclass GithubResponseError extends CustomErrorBase {}\n\nexport const defaultClientFactory: CreateGithubPullRequestActionOptions['clientFactory'] =\n async ({\n integrations,\n githubCredentialsProvider,\n owner,\n repo,\n host = 'github.com',\n token: providedToken,\n }) => {\n const octokitOptions = await getOctokitOptions({\n integrations,\n credentialsProvider: githubCredentialsProvider,\n host,\n owner,\n repo,\n token: providedToken,\n });\n\n const OctokitPR = Octokit.plugin(createPullRequest);\n return new OctokitPR({\n ...octokitOptions,\n ...{ throttle: { enabled: false } },\n });\n };\n\n/**\n * The options passed to {@link createPublishGithubPullRequestAction} method\n * @public\n */\nexport interface CreateGithubPullRequestActionOptions {\n /**\n * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.\n */\n integrations: ScmIntegrationRegistry;\n /**\n * An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.\n */\n githubCredentialsProvider?: GithubCredentialsProvider;\n /**\n * Whether this action must use credentials provided through its input.\n */\n requireScmUserCredentials?: boolean;\n /**\n * A method to return the Octokit client with the Pull Request Plugin.\n */\n clientFactory?: (input: {\n integrations: ScmIntegrationRegistry;\n githubCredentialsProvider?: GithubCredentialsProvider;\n host: string;\n owner: string;\n repo: string;\n token?: string;\n }) => Promise<\n Octokit & {\n createPullRequest(options: createPullRequest.Options): Promise<{\n data: {\n html_url: string;\n number: number;\n base: {\n ref: string;\n };\n };\n } | null>;\n }\n >;\n /**\n * An instance of {@link @backstage/config#Config} that will be used in the action.\n */\n config?: Config;\n}\n\ntype GithubPullRequest = {\n owner: string;\n repo: string;\n number: number;\n};\n\n/**\n * Creates a Github Pull Request action.\n * @public\n */\nexport const createPublishGithubPullRequestAction = (\n options: CreateGithubPullRequestActionOptions,\n) => {\n const {\n integrations,\n githubCredentialsProvider,\n clientFactory = defaultClientFactory,\n config,\n requireScmUserCredentials,\n } = options;\n\n return createTemplateAction({\n id: 'publish:github:pull-request',\n examples,\n supportsDryRun: true,\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 repository name and `owner` is an organization or username',\n }),\n branchName: z =>\n z.string({\n description: 'The name for the branch',\n }),\n filesToDelete: z =>\n z\n .array(z.string(), {\n description: 'List of files that will be deleted',\n })\n .optional(),\n targetBranchName: z =>\n z\n .string({\n description: 'The target branch name of the pull request',\n })\n .optional(),\n title: z =>\n z.string({\n description: 'The name for the pull request',\n }),\n description: z =>\n z.string({\n description: 'The description of the pull request',\n }),\n draft: z =>\n z\n .boolean({\n description: 'Create a draft pull request',\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description:\n 'Subdirectory of working directory to copy changes from',\n })\n .optional(),\n targetPath: z =>\n z\n .string({\n description: 'Subdirectory of repository to apply changes to',\n })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitHub',\n })\n .optional(),\n reviewers: z =>\n z\n .array(z.string(), {\n description:\n 'The users that will be added as reviewers to the pull request',\n })\n .optional(),\n assignees: z =>\n z\n .array(z.string(), {\n description:\n 'The users that will be added as assignees to the pull request',\n })\n .optional(),\n teamReviewers: z =>\n z\n .array(z.string(), {\n description:\n 'The teams that will be added as reviewers to the pull request',\n })\n .optional(),\n commitMessage: z =>\n z\n .string({\n description: 'The commit message for the pull request commit',\n })\n .optional(),\n update: z =>\n z\n .boolean({\n description: 'Update pull request if already exists',\n })\n .optional(),\n forceFork: z =>\n z\n .boolean({\n description: 'Create pull request from a fork',\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description:\n 'Sets the default author name for the commit. The default value is the authenticated user or `Scaffolder`',\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description:\n 'Sets the default author email for the commit. The default value is the authenticated user or `scaffolder@backstage.io`',\n })\n .optional(),\n forceEmptyGitAuthor: z =>\n z\n .boolean({\n description:\n 'Forces the author to be empty. This is useful when using a Github App, it permit the commit to be verified on Github',\n })\n .optional(),\n createWhenEmpty: z =>\n z\n .boolean({\n description:\n 'Set whether to create pull request when there are no changes to commit. The default value is true. If set to false, remoteUrl is no longer a required output.',\n })\n .optional(),\n },\n output: {\n targetBranchName: z =>\n z.string({\n description: 'Target branch name of the merge request',\n }),\n remoteUrl: z =>\n z.string({\n description: 'Link to the pull request in Github',\n }),\n pullRequestNumber: z =>\n z.number({\n description: 'The pull request number',\n }),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n branchName,\n filesToDelete,\n targetBranchName,\n title,\n description,\n draft,\n targetPath,\n sourcePath,\n token: providedToken,\n reviewers,\n assignees,\n teamReviewers,\n commitMessage,\n update,\n forceFork,\n gitAuthorEmail,\n gitAuthorName,\n forceEmptyGitAuthor,\n createWhenEmpty,\n } = ctx.input;\n\n const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(\n `No owner provided for host: ${host}, and repo ${repo}`,\n );\n }\n\n if (requireScmUserCredentials && !providedToken) {\n throw new InputError(\n `No user credentials provided for host ${host}, but scaffolder.requireScmUserCredentials is enabled`,\n );\n }\n\n const client = await clientFactory({\n integrations,\n githubCredentialsProvider,\n host,\n owner,\n repo,\n token: providedToken,\n });\n\n const fileRoot = sourcePath\n ? resolveSafeChildPath(ctx.workspacePath, sourcePath)\n : ctx.workspacePath;\n\n const directoryContents = await serializeDirectoryContents(fileRoot, {\n gitignore: true,\n });\n\n const determineFileMode = (file: SerializedFile): string => {\n if (file.symlink) return '120000';\n if (file.executable) return '100755';\n return '100644';\n };\n\n const determineFileEncoding = (\n file: SerializedFile,\n ): 'utf-8' | 'base64' => (file.symlink ? 'utf-8' : 'base64');\n\n const files = Object.fromEntries([\n ...directoryContents.map(file => [\n targetPath ? path.posix.join(targetPath, file.path) : file.path,\n {\n // See the properties of tree items\n // in https://docs.github.com/en/rest/reference/git#trees\n mode: determineFileMode(file),\n // Always use base64 encoding where possible to avoid doubling a binary file in size\n // due to interpreting a binary file as utf-8 and sending github\n // the utf-8 encoded content. Symlinks are kept as utf-8 to avoid them\n // being formatted as a series of scrambled characters\n //\n // For example, the original gradle-wrapper.jar is 57.8k in https://github.com/kennethzfeng/pull-request-test/pull/5/files.\n // Its size could be doubled to 98.3K (See https://github.com/kennethzfeng/pull-request-test/pull/4/files)\n encoding: determineFileEncoding(file),\n content: file.content.toString(determineFileEncoding(file)),\n },\n ]),\n // order of arrays is important so filesToDelete will overwrite\n // changes from files above\n ...(filesToDelete || []).map(filePath => [\n targetPath ? path.posix.join(targetPath, filePath) : filePath,\n DELETE_FILE,\n ]),\n ]);\n\n // If this is a dry run, log and return\n if (ctx.isDryRun) {\n ctx.logger.info(`Performing dry run of creating pull request`);\n ctx.output('targetBranchName', branchName);\n ctx.output('remoteUrl', repoUrl);\n ctx.output('pullRequestNumber', 43);\n ctx.logger.info(`Dry run complete`);\n return;\n }\n\n try {\n const createOptions: createPullRequest.Options = {\n owner,\n repo,\n title,\n changes: [\n {\n files,\n commit:\n commitMessage ??\n config?.getOptionalString('scaffolder.defaultCommitMessage') ??\n title,\n },\n ],\n body: description,\n head: branchName,\n draft,\n update,\n forceFork,\n createWhenEmpty,\n };\n\n const gitAuthorInfo = {\n name:\n gitAuthorName ??\n config?.getOptionalString('scaffolder.defaultAuthor.name'),\n email:\n gitAuthorEmail ??\n config?.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n if (!forceEmptyGitAuthor) {\n if (gitAuthorInfo.name || gitAuthorInfo.email) {\n if (Array.isArray(createOptions.changes)) {\n createOptions.changes = createOptions.changes.map(change => ({\n ...change,\n author: {\n name: gitAuthorInfo.name || 'Scaffolder',\n email: gitAuthorInfo.email || 'scaffolder@backstage.io',\n },\n }));\n } else {\n createOptions.changes = {\n ...createOptions.changes,\n author: {\n name: gitAuthorInfo.name || 'Scaffolder',\n email: gitAuthorInfo.email || 'scaffolder@backstage.io',\n },\n };\n }\n }\n }\n\n if (targetBranchName) {\n createOptions.base = targetBranchName;\n }\n\n const pr = await ctx.checkpoint({\n key: `create.pr.${owner}.${repo}.${branchName}`,\n fn: async () => {\n const response = await client.createPullRequest(createOptions);\n if (!response) {\n return null;\n }\n\n return {\n base: response?.data.base,\n html_url: response?.data.html_url,\n number: response?.data.number,\n };\n },\n });\n\n if (createWhenEmpty === false && !pr) {\n ctx.logger.info('No changes to commit, pull request was not created');\n return;\n }\n\n if (!pr) {\n throw new GithubResponseError('null response from Github');\n }\n\n const pullRequestNumber = pr.number;\n const pullRequest = { owner, repo, number: pullRequestNumber };\n if (reviewers || teamReviewers) {\n await requestReviewersOnPullRequest(\n pullRequest,\n reviewers,\n teamReviewers,\n client,\n ctx.logger,\n ctx.checkpoint,\n );\n }\n\n if (assignees) {\n if (assignees.length > 10) {\n ctx.logger.warn(\n 'Assignees list is too long, only the first 10 will be used.',\n );\n }\n await addAssigneesToPullRequest(\n pullRequest,\n assignees,\n client,\n ctx.logger,\n ctx.checkpoint,\n );\n }\n\n const targetBranch = pr.base.ref;\n ctx.output('targetBranchName', targetBranch);\n ctx.output('remoteUrl', pr.html_url);\n ctx.output('pullRequestNumber', pullRequestNumber);\n } catch (e) {\n throw new GithubResponseError('Pull request creation failed', e);\n }\n },\n });\n\n async function addAssigneesToPullRequest(\n pr: GithubPullRequest,\n assignees: string[],\n client: Octokit,\n logger: LoggerService,\n checkpoint: <T extends JsonValue | void>(opts: {\n key: string;\n fn: () => Promise<T> | T;\n }) => Promise<T>,\n ) {\n try {\n await checkpoint({\n key: `add.assignees.${pr.owner}.${pr.repo}.${pr.number}`,\n fn: async () => {\n const result = await client.rest.issues.addAssignees({\n owner: pr.owner,\n repo: pr.repo,\n issue_number: pr.number,\n assignees,\n });\n\n const addedAssignees = result.data.assignees?.join(', ') ?? '';\n\n logger.info(\n `Added assignees [${addedAssignees}] to Pull request ${pr.number}`,\n );\n },\n });\n } catch (e) {\n logger.error(\n `Failure when adding assignees to Pull request ${pr.number}`,\n e,\n );\n }\n }\n\n async function requestReviewersOnPullRequest(\n pr: GithubPullRequest,\n reviewers: string[] | undefined,\n teamReviewers: string[] | undefined,\n client: Octokit,\n logger: LoggerService,\n checkpoint: <T extends JsonValue | void>(opts: {\n key: string;\n fn: () => Promise<T> | T;\n }) => Promise<T>,\n ) {\n try {\n await checkpoint({\n key: `request.reviewers.${pr.owner}.${pr.repo}.${pr.number}`,\n fn: async () => {\n const result = await client.rest.pulls.requestReviewers({\n owner: pr.owner,\n repo: pr.repo,\n pull_number: pr.number,\n reviewers,\n team_reviewers: teamReviewers\n ? [...new Set(teamReviewers)]\n : undefined,\n });\n\n const addedUsers = result.data.requested_reviewers?.join(', ') ?? '';\n const addedTeams = result.data.requested_teams?.join(', ') ?? '';\n\n logger.info(\n `Added users [${addedUsers}] and teams [${addedTeams}] as reviewers to Pull request ${pr.number}`,\n );\n },\n });\n } catch (e) {\n logger.error(\n `Failure when adding reviewers to Pull request ${pr.number}`,\n e,\n );\n }\n }\n};\n"],"names":["CustomErrorBase","getOctokitOptions","Octokit","createPullRequest","createTemplateAction","examples","parseRepoUrl","InputError","resolveSafeChildPath","serializeDirectoryContents","path","DELETE_FILE"],"mappings":";;;;;;;;;;;;;;;AA4CA,MAAM,4BAA4BA,sBAAA,CAAgB;AAAC;AAE5C,MAAM,uBACX,OAAO;AAAA,EACL,YAAA;AAAA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AG;AACV,MAAA,MAAA,CAAO,KAAA;AAAA,QACL,CAAA,8CAAA,EAAiD,GAAG,MAAM,CAAA,CAAA;AAAA,QAC1D;AAAA,OACF;AAAA,IACF;AAAA,EACF;AACF;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubPullRequest.examples.cjs.js","sources":["../../src/actions/githubPullRequest.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a pull request',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with target branch name',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with target branch name',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetBranchName: 'test',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request as draft',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request as draft',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n draft: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with target path',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with target path',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetPath: 'targetPath',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with source path',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with source path',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n sourcePath: 'source',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with token',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with reviewers',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n reviewers: ['foobar'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with team reviewers',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with team reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n teamReviewers: ['team-foo'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with commit message',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n commitMessage: 'Custom commit message',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author name and email',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n gitAuthorName: 'Foo Bar',\n gitAuthorEmail: 'foo@bar.example',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author name',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n // gitAuthorEmail will be 'scaffolder@backstage.io'\n // once one author attribute has been set we need to set both\n gitAuthorName: 'Foo Bar',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author email',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n // gitAuthorName will be 'Scaffolder'\n // once one author attribute has been set we need to set both\n gitAuthorEmail: 'foo@bar.example',\n },\n },\n ],\n }),\n },\n {\n description: 'Do not create empty pull request',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n createWhenEmpty: false,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with all parameters',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetBranchName: 'test',\n draft: true,\n targetPath: 'targetPath',\n sourcePath: 'source',\n token: 'gph_YourGitHubToken',\n reviewers: ['foobar'],\n teamReviewers: ['team-foo'],\n commitMessage: 'Commit for foo changes',\n gitAuthorName: 'Foo Bar',\n gitAuthorEmail: 'foo@bar.example',\n createWhenEmpty: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with assignees',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n assignees: ['foobar'],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,uBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YACP,WAAA,EAAa;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,+CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,+CAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YACP,WAAA,EAAa,wBAAA;AAAA,YACb,gBAAA,EAAkB;AAAA;AACpB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,gCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,Q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;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,sCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YACP,WAAA,EAAa,wBAAA;AAAA,YACb,SAAA,EAAW,CAAC,QAAQ;AAAA;AACtB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
1
|
+
{"version":3,"file":"githubPullRequest.examples.cjs.js","sources":["../../src/actions/githubPullRequest.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Create a pull request',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with target branch name',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with target branch name',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetBranchName: 'test',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request as draft',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request as draft',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n draft: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with target path',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with target path',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetPath: 'targetPath',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with source path',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with source path',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n sourcePath: 'source',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with token',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n token: 'gph_YourGitHubToken',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with reviewers',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n reviewers: ['foobar'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with team reviewers',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with team reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n teamReviewers: ['team-foo'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with commit message',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n commitMessage: 'Custom commit message',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author name and email',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n gitAuthorName: 'Foo Bar',\n gitAuthorEmail: 'foo@bar.example',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author name',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n // gitAuthorEmail will be 'scaffolder@backstage.io'\n // once one author attribute has been set we need to set both\n gitAuthorName: 'Foo Bar',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with a git author email',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n // gitAuthorName will be 'Scaffolder'\n // once one author attribute has been set we need to set both\n gitAuthorEmail: 'foo@bar.example',\n },\n },\n ],\n }),\n },\n {\n description: 'Do not create empty pull request',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n createWhenEmpty: false,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with all parameters',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n targetBranchName: 'test',\n draft: true,\n targetPath: 'targetPath',\n sourcePath: 'source',\n token: 'gph_YourGitHubToken',\n reviewers: ['foobar'],\n teamReviewers: ['team-foo'],\n commitMessage: 'Commit for foo changes',\n gitAuthorName: 'Foo Bar',\n gitAuthorEmail: 'foo@bar.example',\n createWhenEmpty: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a pull request with assignees',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:github:pull-request',\n name: 'Create a pull request with reviewers',\n input: {\n repoUrl: 'github.com?repo=repo&owner=owner',\n branchName: 'new-app',\n title: 'Create my new app',\n description: 'This PR is really good',\n assignees: ['foobar'],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,uBAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,uBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YACP,WAAA,EAAa;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,+CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,+CAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YAC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AA;AAAA,YAC1B,aAAA,EAAe,wBAAA;AAAA,YACf,aAAA,EAAe,SAAA;AAAA,YACf,cAAA,EAAgB,iBAAA;AAAA,YAChB,eAAA,EAAiB;AAAA;AACnB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,sCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,MAAA,EAAQ,6BAAA;AAAA,UACR,IAAA,EAAM,sCAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,UAAA,EAAY,SAAA;AAAA,YACZ,KAAA,EAAO,mBAAA;AAAA,YACP,WAAA,EAAa,wBAAA;AAAA,YACb,SAAA,EAAW,CAAC,QAAQ;AAAA;AACtB;AACF;AACF,KACD;AAAA;AAEL;;"}
|
|
@@ -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 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","outputProps.repo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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
|
|
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","outputProps.repoContentsUrl","parseRepoUrl","InputError","getOctokitOptions","Octokit","createGithubRepoWithCollaboratorsAndTopics"],"mappings":";;;;;;;;;;;AAqCO,SAAS,6BAA6B,OAAA,EAI1C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,yBAAA,EAA2B,yBAAA,EAA0B,GACzE,OAAA;AAEF,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,oBAAA;AAAA,IACJ,WAAA,EAAa,8BAAA;AAAA,cACbC,kCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,QAAQC,sBAAW;AAAA,QACnB,gBAAgBC,8BAAW;AAAA,QAC3B,kBAAkBC,gCAAW;AAAA,QAC7B,kBAAkBC,gCAAW;AAAA,QAC7B,kBAAkBC,gCAAW;AAAA,QAC7B,mBAAmBC,iCAAW;AAAA,QAC9B,UAAUC,wBAAW;AAAA,QACrB,eAAeC,6BAAW;AAAA,QAC1B,kBAAkBC,gCAAW;AAAA,QAC7B,qBAAqBC,mCAAW;AAAA,QAChC,aAAaC,2BAAW;AAAA,QACxB,WAAWC,yBAAW;AAAA,QACtB,aAAaC,2BAAW;AAAA,QACxB,SAASC,uBAAW;AAAA,QACpB,UAAUC,wBAAW;AAAA,QACrB,mBAAmBC,iCAAW;AAAA,QAC9B,SAASC,uBAAW;AAAA,QACpB,eAAeC,6BAAW;AAAA,QAC1B,gBAAgBC,8BAAW;AAAA,QAC3B,SAASC,uBAAW;AAAA,QACpB,0BAA0BC,wCAAW;AAAA,QACrC,wBAAwBC,sCAAW;AAAA,QACnC,WAA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