@backstage/plugin-scaffolder-backend-module-github 0.5.1-next.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/actions/gitHelpers.cjs.js +90 -0
  3. package/dist/actions/gitHelpers.cjs.js.map +1 -0
  4. package/dist/actions/gitHubEnvironment.examples.cjs.js +340 -0
  5. package/dist/actions/gitHubEnvironment.examples.cjs.js.map +1 -0
  6. package/dist/actions/github.cjs.js +187 -0
  7. package/dist/actions/github.cjs.js.map +1 -0
  8. package/dist/actions/github.examples.cjs.js +60 -0
  9. package/dist/actions/github.examples.cjs.js.map +1 -0
  10. package/dist/actions/githubActionsDispatch.cjs.js +84 -0
  11. package/dist/actions/githubActionsDispatch.cjs.js.map +1 -0
  12. package/dist/actions/githubActionsDispatch.examples.cjs.js +66 -0
  13. package/dist/actions/githubActionsDispatch.examples.cjs.js.map +1 -0
  14. package/dist/actions/githubAutolinks.cjs.js +76 -0
  15. package/dist/actions/githubAutolinks.cjs.js.map +1 -0
  16. package/dist/actions/githubAutolinks.examples.cjs.js +30 -0
  17. package/dist/actions/githubAutolinks.examples.cjs.js.map +1 -0
  18. package/dist/actions/githubBranchProtection.cjs.js +97 -0
  19. package/dist/actions/githubBranchProtection.cjs.js.map +1 -0
  20. package/dist/actions/githubBranchProtection.examples.cjs.js +62 -0
  21. package/dist/actions/githubBranchProtection.examples.cjs.js.map +1 -0
  22. package/dist/actions/githubDeployKey.cjs.js +123 -0
  23. package/dist/actions/githubDeployKey.cjs.js.map +1 -0
  24. package/dist/actions/githubDeployKey.examples.cjs.js +30 -0
  25. package/dist/actions/githubDeployKey.examples.cjs.js.map +1 -0
  26. package/dist/actions/githubEnvironment.cjs.js +255 -0
  27. package/dist/actions/githubEnvironment.cjs.js.map +1 -0
  28. package/dist/actions/githubIssuesLabel.cjs.js +79 -0
  29. package/dist/actions/githubIssuesLabel.cjs.js.map +1 -0
  30. package/dist/actions/githubIssuesLabel.examples.cjs.js +46 -0
  31. package/dist/actions/githubIssuesLabel.examples.cjs.js.map +1 -0
  32. package/dist/actions/githubPagesEnable.cjs.js +88 -0
  33. package/dist/actions/githubPagesEnable.cjs.js.map +1 -0
  34. package/dist/actions/githubPagesEnable.examples.cjs.js +224 -0
  35. package/dist/actions/githubPagesEnable.examples.cjs.js.map +1 -0
  36. package/dist/actions/githubPullRequest.cjs.js +336 -0
  37. package/dist/actions/githubPullRequest.cjs.js.map +1 -0
  38. package/dist/actions/githubPullRequest.examples.cjs.js +260 -0
  39. package/dist/actions/githubPullRequest.examples.cjs.js.map +1 -0
  40. package/dist/actions/githubRepoCreate.cjs.js +130 -0
  41. package/dist/actions/githubRepoCreate.cjs.js.map +1 -0
  42. package/dist/actions/githubRepoCreate.examples.cjs.js +964 -0
  43. package/dist/actions/githubRepoCreate.examples.cjs.js.map +1 -0
  44. package/dist/actions/githubRepoPush.cjs.js +122 -0
  45. package/dist/actions/githubRepoPush.cjs.js.map +1 -0
  46. package/dist/actions/githubRepoPush.examples.cjs.js +57 -0
  47. package/dist/actions/githubRepoPush.examples.cjs.js.map +1 -0
  48. package/dist/actions/githubWebhook.cjs.js +135 -0
  49. package/dist/actions/githubWebhook.cjs.js.map +1 -0
  50. package/dist/actions/githubWebhook.examples.cjs.js +113 -0
  51. package/dist/actions/githubWebhook.examples.cjs.js.map +1 -0
  52. package/dist/actions/helpers.cjs.js +292 -0
  53. package/dist/actions/helpers.cjs.js.map +1 -0
  54. package/dist/actions/inputProperties.cjs.js +319 -0
  55. package/dist/actions/inputProperties.cjs.js.map +1 -0
  56. package/dist/actions/outputProperties.cjs.js +19 -0
  57. package/dist/actions/outputProperties.cjs.js.map +1 -0
  58. package/dist/index.cjs.js +31 -4306
  59. package/dist/index.cjs.js.map +1 -1
  60. package/dist/index.d.ts +33 -1
  61. package/dist/module.cjs.js +92 -0
  62. package/dist/module.cjs.js.map +1 -0
  63. package/package.json +11 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"githubEnvironment.cjs.js","sources":["../../src/actions/githubEnvironment.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { getOctokitOptions } from './helpers';\nimport { Octokit } from 'octokit';\nimport Sodium from 'libsodium-wrappers';\nimport { examples } from './gitHubEnvironment.examples';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * Creates an `github:environment:create` Scaffolder action that creates a Github Environment.\n *\n * @public\n */\nexport function createGithubEnvironmentAction(options: {\n integrations: ScmIntegrationRegistry;\n catalogClient?: CatalogApi;\n}) {\n const { integrations, catalogClient } = options;\n // For more information on how to define custom actions, see\n // https://backstage.io/docs/features/software-templates/writing-custom-actions\n return createTemplateAction<{\n repoUrl: string;\n name: string;\n deploymentBranchPolicy?: {\n protected_branches: boolean;\n custom_branch_policies: boolean;\n };\n customBranchPolicyNames?: string[];\n customTagPolicyNames?: string[];\n environmentVariables?: { [key: string]: string };\n secrets?: { [key: string]: string };\n token?: string;\n waitTimer?: number;\n preventSelfReview?: boolean;\n reviewers?: string[];\n }>({\n id: 'github:environment:create',\n description: 'Creates Deployment Environments',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'name'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`,\n type: 'string',\n },\n name: {\n title: 'Environment Name',\n description: `Name of the deployment environment to create`,\n type: 'string',\n },\n deploymentBranchPolicy: {\n title: 'Deployment Branch Policy',\n description: `The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.`,\n type: 'object',\n required: ['protected_branches', 'custom_branch_policies'],\n properties: {\n protected_branches: {\n title: 'Protected Branches',\n description: `Whether only branches with branch protection rules can deploy to this environment. If protected_branches is true, custom_branch_policies must be false; if protected_branches is false, custom_branch_policies must be true.`,\n type: 'boolean',\n },\n custom_branch_policies: {\n title: 'Custom Branch Policies',\n description: `Whether only branches that match the specified name patterns can deploy to this environment. If custom_branch_policies is true, protected_branches must be false; if custom_branch_policies is false, protected_branches must be true.`,\n type: 'boolean',\n },\n },\n },\n customBranchPolicyNames: {\n title: 'Custom Branch Policy Name',\n description: `The name pattern that branches must match in order to deploy to the environment.\n\n Wildcard characters will not match /. For example, to match branches that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n type: 'array',\n items: {\n type: 'string',\n },\n },\n customTagPolicyNames: {\n title: 'Custom Tag Policy Name',\n description: `The name pattern that tags must match in order to deploy to the environment.\n\n Wildcard characters will not match /. For example, to match tags that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`,\n type: 'array',\n items: {\n type: 'string',\n },\n },\n environmentVariables: {\n title: 'Environment Variables',\n description: `Environment variables attached to the deployment environment`,\n type: 'object',\n },\n secrets: {\n title: 'Deployment Secrets',\n description: `Secrets attached to the deployment environment`,\n type: 'object',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to GitHub',\n },\n waitTimer: {\n title: 'Wait Timer',\n type: 'integer',\n description:\n 'The time to wait before creating or updating the environment (in milliseconds)',\n },\n preventSelfReview: {\n title: 'Prevent Self Review',\n type: 'boolean',\n description: 'Whether to prevent self-review for this environment',\n },\n reviewers: {\n title: 'Reviewers',\n type: 'array',\n description: 'Reviewers for this environment',\n items: {\n type: 'string',\n },\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n name,\n deploymentBranchPolicy,\n customBranchPolicyNames,\n customTagPolicyNames,\n environmentVariables,\n secrets,\n token: providedToken,\n waitTimer,\n preventSelfReview,\n reviewers,\n } = ctx.input;\n\n // When environment creation step is executed right after a repo publish step, the repository might not be available immediately.\n // Add a 2-second delay before initiating the steps in this action.\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n const octokitOptions = await getOctokitOptions({\n integrations,\n token: providedToken,\n repoUrl: repoUrl,\n });\n\n const { owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError(`No owner provided for repo ${repoUrl}`);\n }\n\n const client = new Octokit(octokitOptions);\n const repository = await client.rest.repos.get({\n owner: owner,\n repo: repo,\n });\n\n // convert reviewers from catalog entity to Github user or team\n const githubReviewers: { type: 'User' | 'Team'; id: number }[] = [];\n if (reviewers) {\n let reviewersEntityRefs: Array<Entity | undefined> = [];\n // Fetch reviewers from Catalog\n const catalogResponse = await catalogClient?.getEntitiesByRefs({\n entityRefs: reviewers,\n });\n if (catalogResponse?.items?.length) {\n reviewersEntityRefs = catalogResponse.items;\n }\n\n for (const reviewerEntityRef of reviewersEntityRefs) {\n if (reviewerEntityRef?.kind === 'User') {\n try {\n const user = await client.rest.users.getByUsername({\n username: reviewerEntityRef.metadata.name,\n });\n githubReviewers.push({\n type: 'User',\n id: user.data.id,\n });\n } catch (error) {\n ctx.logger.error('User not found:', error);\n }\n } else if (reviewerEntityRef?.kind === 'Group') {\n try {\n const team = await client.rest.teams.getByName({\n org: owner,\n team_slug: reviewerEntityRef.metadata.name,\n });\n githubReviewers.push({\n type: 'Team',\n id: team.data.id,\n });\n } catch (error) {\n ctx.logger.error('Team not found:', error);\n }\n }\n }\n }\n\n await client.rest.repos.createOrUpdateEnvironment({\n owner: owner,\n repo: repo,\n environment_name: name,\n deployment_branch_policy: deploymentBranchPolicy ?? null,\n wait_timer: waitTimer ?? 0,\n prevent_self_review: preventSelfReview ?? false,\n reviewers: githubReviewers.length ? githubReviewers : null,\n });\n\n if (customBranchPolicyNames) {\n for (const item of customBranchPolicyNames) {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'branch',\n environment_name: name,\n name: item,\n });\n }\n }\n\n if (customTagPolicyNames) {\n for (const item of customTagPolicyNames) {\n await client.rest.repos.createDeploymentBranchPolicy({\n owner: owner,\n repo: repo,\n type: 'tag',\n environment_name: name,\n name: item,\n });\n }\n }\n\n for (const [key, value] of Object.entries(environmentVariables ?? {})) {\n await client.rest.actions.createEnvironmentVariable({\n repository_id: repository.data.id,\n owner: owner,\n repo: repo,\n environment_name: name,\n name: key,\n value,\n });\n }\n\n if (secrets) {\n const publicKeyResponse =\n await client.rest.actions.getEnvironmentPublicKey({\n repository_id: repository.data.id,\n owner: owner,\n repo: repo,\n environment_name: name,\n });\n\n await Sodium.ready;\n const binaryKey = Sodium.from_base64(\n publicKeyResponse.data.key,\n Sodium.base64_variants.ORIGINAL,\n );\n for (const [key, value] of Object.entries(secrets)) {\n const binarySecret = Sodium.from_string(value);\n const encryptedBinarySecret = Sodium.crypto_box_seal(\n binarySecret,\n binaryKey,\n );\n const encryptedBase64Secret = Sodium.to_base64(\n encryptedBinarySecret,\n Sodium.base64_variants.ORIGINAL,\n );\n\n await client.rest.actions.createOrUpdateEnvironmentSecret({\n repository_id: repository.data.id,\n owner: owner,\n repo: repo,\n environment_name: name,\n secret_name: key,\n encrypted_value: encryptedBase64Secret,\n key_id: publicKeyResponse.data.key_id,\n });\n }\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","getOctokitOptions","parseRepoUrl","InputError","Octokit","Sodium"],"mappings":";;;;;;;;;;;;;AAkCO,SAAS,8BAA8B,OAG3C,EAAA;AACD,EAAM,MAAA,EAAE,YAAc,EAAA,aAAA,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/plugin-scaffolder-node');
4
+ var errors = require('@backstage/errors');
5
+ var octokit = require('octokit');
6
+ var helpers = require('./helpers.cjs.js');
7
+ var githubIssuesLabel_examples = require('./githubIssuesLabel.examples.cjs.js');
8
+
9
+ function createGithubIssuesLabelAction(options) {
10
+ const { integrations, githubCredentialsProvider } = options;
11
+ return pluginScaffolderNode.createTemplateAction({
12
+ id: "github:issues:label",
13
+ description: "Adds labels to a pull request or issue on GitHub.",
14
+ examples: githubIssuesLabel_examples.examples,
15
+ schema: {
16
+ input: {
17
+ type: "object",
18
+ required: ["repoUrl", "number", "labels"],
19
+ properties: {
20
+ repoUrl: {
21
+ title: "Repository Location",
22
+ description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the repository name and 'owner' is an organization or username`,
23
+ type: "string"
24
+ },
25
+ number: {
26
+ title: "Pull Request or issue number",
27
+ description: "The pull request or issue number to add labels to",
28
+ type: "number"
29
+ },
30
+ labels: {
31
+ title: "Labels",
32
+ description: "The labels to add to the pull request or issue",
33
+ type: "array",
34
+ items: {
35
+ type: "string"
36
+ }
37
+ },
38
+ token: {
39
+ title: "Authentication Token",
40
+ type: "string",
41
+ description: "The GITHUB_TOKEN to use for authorization to GitHub"
42
+ }
43
+ }
44
+ }
45
+ },
46
+ async handler(ctx) {
47
+ const { repoUrl, number, labels, token: providedToken } = ctx.input;
48
+ const { owner, repo } = pluginScaffolderNode.parseRepoUrl(repoUrl, integrations);
49
+ ctx.logger.info(`Adding labels to ${number} issue on repo ${repo}`);
50
+ if (!owner) {
51
+ throw new errors.InputError("Invalid repository owner provided in repoUrl");
52
+ }
53
+ const client = new octokit.Octokit(
54
+ await helpers.getOctokitOptions({
55
+ integrations,
56
+ credentialsProvider: githubCredentialsProvider,
57
+ repoUrl,
58
+ token: providedToken
59
+ })
60
+ );
61
+ try {
62
+ await client.rest.issues.addLabels({
63
+ owner,
64
+ repo,
65
+ issue_number: number,
66
+ labels
67
+ });
68
+ } catch (e) {
69
+ errors.assertError(e);
70
+ ctx.logger.warn(
71
+ `Failed: adding labels to issue: '${number}' on repo: '${repo}', ${e.message}`
72
+ );
73
+ }
74
+ }
75
+ });
76
+ }
77
+
78
+ exports.createGithubIssuesLabelAction = createGithubIssuesLabelAction;
79
+ //# sourceMappingURL=githubIssuesLabel.cjs.js.map
@@ -0,0 +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 { assertError, InputError } from '@backstage/errors';\nimport { Octokit } from 'octokit';\nimport { getOctokitOptions } from './helpers';\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}) {\n const { integrations, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n number: number;\n labels: string[];\n token?: string;\n }>({\n id: 'github:issues:label',\n description: 'Adds labels to a pull request or issue on GitHub.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'number', 'labels'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the repository name and 'owner' is an organization or username`,\n type: 'string',\n },\n number: {\n title: 'Pull Request or issue number',\n description: 'The pull request or issue number to add labels to',\n type: 'number',\n },\n labels: {\n title: 'Labels',\n description: 'The labels to add to the pull request or issue',\n type: 'array',\n items: {\n type: 'string',\n },\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The GITHUB_TOKEN to use for authorization to GitHub',\n },\n },\n },\n },\n async handler(ctx) {\n const { repoUrl, number, labels, token: providedToken } = ctx.input;\n\n const { 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 client = new Octokit(\n await getOctokitOptions({\n integrations,\n credentialsProvider: githubCredentialsProvider,\n repoUrl: repoUrl,\n token: providedToken,\n }),\n );\n\n try {\n await client.rest.issues.addLabels({\n owner,\n repo,\n issue_number: number,\n labels,\n });\n } catch (e) {\n assertError(e);\n ctx.logger.warn(\n `Failed: adding labels to issue: '${number}' on repo: '${repo}', ${e.message}`,\n );\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","Octokit","getOctokitOptions","assertError"],"mappings":";;;;;;;;AAiCO,SAAS,8BAA8B,OAG3C,EAAA;AACD,EAAM,MAAA,EAAE,YAAc,EAAA,yBAAA,EAA8B,GAAA,OAAA,CAAA;AAEpD,EAAA,OAAOA,yCAKJ,CAAA;AAAA,IACD,EAAI,EAAA,qBAAA;AAAA,IACJ,WAAa,EAAA,mDAAA;AAAA,cACbC,mCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAU,EAAA,CAAC,SAAW,EAAA,QAAA,EAAU,QAAQ,CAAA;AAAA,QACxC,UAAY,EAAA;AAAA,UACV,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,qBAAA;AAAA,YACP,WAAa,EAAA,CAAA,4IAAA,CAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,WAC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ACA,IAAA;AAAA,UACA,YAAc,EAAA,MAAA;AAAA,UACd,MAAA;AAAA,SACD,CAAA,CAAA;AAAA,eACM,CAAG,EAAA;AACV,QAAAC,kBAAA,CAAY,CAAC,CAAA,CAAA;AACb,QAAA,GAAA,CAAI,MAAO,CAAA,IAAA;AAAA,UACT,oCAAoC,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,GAAA,EAAM,EAAE,OAAO,CAAA,CAAA;AAAA,SAC9E,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Add labels to pull request or issue",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "github:issues:label",
16
+ name: "Add labels to pull request or issue",
17
+ input: {
18
+ repoUrl: "github.com?repo=repo&owner=owner",
19
+ number: "1",
20
+ labels: ["bug"]
21
+ }
22
+ }
23
+ ]
24
+ })
25
+ },
26
+ {
27
+ description: "Add labels to pull request or issue with specific token",
28
+ example: yaml__default.default.stringify({
29
+ steps: [
30
+ {
31
+ action: "github:issues:label",
32
+ name: "Add labels to pull request or issue with token",
33
+ input: {
34
+ repoUrl: "github.com?repo=repo&owner=owner",
35
+ number: "1",
36
+ labels: ["bug", "documentation"],
37
+ token: "gph_YourGitHubToken"
38
+ }
39
+ }
40
+ ]
41
+ })
42
+ }
43
+ ];
44
+
45
+ exports.examples = examples;
46
+ //# sourceMappingURL=githubIssuesLabel.examples.cjs.js.map
@@ -0,0 +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,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,qCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,qBAAA;AAAA,UACR,IAAM,EAAA,qCAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,MAAQ,EAAA,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAK,CAAA;AAAA,WAChB;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,yDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,qBAAA;AAAA,UACR,IAAM,EAAA,gDAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,MAAQ,EAAA,GAAA;AAAA,YACR,MAAA,EAAQ,CAAC,KAAA,EAAO,eAAe,CAAA;AAAA,YAC/B,KAAO,EAAA,qBAAA;AAAA,WACT;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+ var octokit = require('octokit');
5
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
+ var githubPagesEnable_examples = require('./githubPagesEnable.examples.cjs.js');
7
+ var pluginScaffolderBackendModuleGithub = require('@backstage/plugin-scaffolder-backend-module-github');
8
+
9
+ function createGithubPagesEnableAction(options) {
10
+ const { integrations, githubCredentialsProvider } = options;
11
+ return pluginScaffolderNode.createTemplateAction({
12
+ id: "github:pages:enable",
13
+ examples: githubPagesEnable_examples.examples,
14
+ description: "Enables GitHub Pages for a repository.",
15
+ schema: {
16
+ input: {
17
+ type: "object",
18
+ required: ["repoUrl"],
19
+ properties: {
20
+ repoUrl: {
21
+ title: "Repository Location",
22
+ description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`,
23
+ type: "string"
24
+ },
25
+ buildType: {
26
+ title: "Build Type",
27
+ type: "string",
28
+ description: 'The GitHub Pages build type - "legacy" or "workflow". Default is "workflow'
29
+ },
30
+ sourceBranch: {
31
+ title: "Source Branch",
32
+ type: "string",
33
+ description: 'The the GitHub Pages source branch. Default is "main"'
34
+ },
35
+ sourcePath: {
36
+ title: "Source Path",
37
+ type: "string",
38
+ description: 'The the GitHub Pages source path - "/" or "/docs". Default is "/"'
39
+ },
40
+ token: {
41
+ title: "Authorization Token",
42
+ type: "string",
43
+ description: "The token to use for authorization to GitHub"
44
+ }
45
+ }
46
+ }
47
+ },
48
+ async handler(ctx) {
49
+ const {
50
+ repoUrl,
51
+ buildType = "workflow",
52
+ sourceBranch = "main",
53
+ sourcePath = "/",
54
+ token: providedToken
55
+ } = ctx.input;
56
+ const octokitOptions = await pluginScaffolderBackendModuleGithub.getOctokitOptions({
57
+ integrations,
58
+ credentialsProvider: githubCredentialsProvider,
59
+ token: providedToken,
60
+ repoUrl
61
+ });
62
+ const client = new octokit.Octokit(octokitOptions);
63
+ const { owner, repo } = pluginScaffolderNode.parseRepoUrl(repoUrl, integrations);
64
+ if (!owner) {
65
+ throw new errors.InputError("Invalid repository owner provided in repoUrl");
66
+ }
67
+ ctx.logger.info(
68
+ `Attempting to enable GitHub Pages for ${owner}/${repo} with "${buildType}" build type, on source branch "${sourceBranch}" and source path "${sourcePath}"`
69
+ );
70
+ await client.request("POST /repos/{owner}/{repo}/pages", {
71
+ owner,
72
+ repo,
73
+ build_type: buildType,
74
+ source: {
75
+ branch: sourceBranch,
76
+ path: sourcePath
77
+ },
78
+ headers: {
79
+ "X-GitHub-Api-Version": "2022-11-28"
80
+ }
81
+ });
82
+ ctx.logger.info("Completed enabling GitHub Pages");
83
+ }
84
+ });
85
+ }
86
+
87
+ exports.createGithubPagesEnableAction = createGithubPagesEnableAction;
88
+ //# sourceMappingURL=githubPagesEnable.cjs.js.map
@@ -0,0 +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 '@backstage/plugin-scaffolder-backend-module-github';\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}) {\n const { integrations, githubCredentialsProvider } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n buildType?: 'legacy' | 'workflow';\n sourceBranch?: string;\n sourcePath?: '/' | '/docs';\n token?: string;\n }>({\n id: 'github:pages:enable',\n examples,\n description: 'Enables GitHub Pages for a repository.',\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`,\n type: 'string',\n },\n buildType: {\n title: 'Build Type',\n type: 'string',\n description:\n 'The GitHub Pages build type - \"legacy\" or \"workflow\". Default is \"workflow',\n },\n sourceBranch: {\n title: 'Source Branch',\n type: 'string',\n description:\n 'The the GitHub Pages source branch. Default is \"main\"',\n },\n sourcePath: {\n title: 'Source Path',\n type: 'string',\n description:\n 'The the GitHub Pages source path - \"/\" or \"/docs\". Default is \"/\"',\n },\n token: {\n title: 'Authorization Token',\n type: 'string',\n description: 'The token to use for authorization to GitHub',\n },\n },\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 octokitOptions = await getOctokitOptions({\n integrations,\n credentialsProvider: githubCredentialsProvider,\n token: providedToken,\n repoUrl: repoUrl,\n });\n const client = new Octokit(octokitOptions);\n\n const { owner, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!owner) {\n throw new InputError('Invalid repository owner provided in repoUrl');\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 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 ctx.logger.info('Completed enabling GitHub Pages');\n },\n });\n}\n"],"names":["createTemplateAction","examples","getOctokitOptions","Octokit","parseRepoUrl","InputError"],"mappings":";;;;;;;;AAkCO,SAAS,8BAA8B,OAG3C,EAAA;AACD,EAAM,MAAA,EAAE,YAAc,EAAA,yBAAA,EAA8B,GAAA,OAAA,CAAA;AAEpD,EAAA,OAAOA,yCAMJ,CAAA;AAAA,IACD,EAAI,EAAA,qBAAA;AAAA,cACJC,mCAAA;AAAA,IACA,WAAa,EAAA,wCAAA;AAAA,IACb,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,QACpB,UAAY,EAAA;AAAA,UACV,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,qBAAA;AAAA,YACP,WAAa,EAAA,CAAA,gJAAA,CAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,WACR;AAAA,UACA,SAAW,EAAA;AAAA,YACT,KAAO,EAAA,YAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,YACN,WACE,EAAA,4EAAA;AAAA,WACJ;AAAA,UACA,YAAc,EAAA;AAAA,YACZ,KAAO,EAAA,eAAA;AAAA,YACP,IAAM,EAAA,QAAA;AAAA,YACN,WACE,EAAA,uDAAA;AAAA,WACJ;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA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UACN,MAAQ,EAAA,YAAA;AAAA,UACR,IAAM,EAAA,UAAA;AAAA,SACR;AAAA,QACA,OAAS,EAAA;AAAA,UACP,sBAAwB,EAAA,YAAA;AAAA,SAC1B;AAAA,OACD,CAAA,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,KAAK,iCAAiC,CAAA,CAAA;AAAA,KACnD;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,224 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Enables GitHub Pages for a repository.",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "github:pages",
16
+ id: "github-pages",
17
+ name: "Enable GitHub Pages",
18
+ input: {
19
+ repoUrl: "github.com?repo=repo&owner=owner",
20
+ buildType: "workflow",
21
+ sourceBranch: "main",
22
+ sourcePath: "/",
23
+ token: "gph_YourGitHubToken"
24
+ }
25
+ }
26
+ ]
27
+ })
28
+ },
29
+ {
30
+ description: "Enables GitHub Pages for a repository with a custom source path.",
31
+ example: yaml__default.default.stringify({
32
+ steps: [
33
+ {
34
+ action: "github:pages",
35
+ id: "github-pages-custom-path",
36
+ name: "Enable GitHub Pages with Custom Source Path",
37
+ input: {
38
+ repoUrl: "github.com?repo=customPathRepo&owner=customOwner",
39
+ sourcePath: "/docs",
40
+ token: "gph_YourGitHubToken"
41
+ }
42
+ }
43
+ ]
44
+ })
45
+ },
46
+ {
47
+ description: "Enables GitHub Pages for a repository using legacy build type.",
48
+ example: yaml__default.default.stringify({
49
+ steps: [
50
+ {
51
+ action: "github:pages",
52
+ id: "github-pages-legacy",
53
+ name: "Enable GitHub Pages with Legacy Build Type",
54
+ input: {
55
+ repoUrl: "github.com?repo=legacyRepo&owner=legacyOwner",
56
+ buildType: "legacy",
57
+ token: "gph_YourGitHubToken"
58
+ }
59
+ }
60
+ ]
61
+ })
62
+ },
63
+ {
64
+ description: "Enables GitHub Pages for a repository with a custom source branch.",
65
+ example: yaml__default.default.stringify({
66
+ steps: [
67
+ {
68
+ action: "github:pages",
69
+ id: "github-pages-custom-branch",
70
+ name: "Enable GitHub Pages with Custom Source Branch",
71
+ input: {
72
+ repoUrl: "github.com?repo=customBranchRepo&owner=branchOwner",
73
+ sourceBranch: "develop",
74
+ token: "gph_YourGitHubToken"
75
+ }
76
+ }
77
+ ]
78
+ })
79
+ },
80
+ {
81
+ description: "Enables GitHub Pages for a repository with full customization.",
82
+ example: yaml__default.default.stringify({
83
+ steps: [
84
+ {
85
+ action: "github:pages",
86
+ id: "github-pages-full-custom",
87
+ name: "Enable GitHub Pages with Full Customization",
88
+ input: {
89
+ repoUrl: "github.com?repo=fullCustomRepo&owner=customOwner",
90
+ buildType: "workflow",
91
+ sourceBranch: "main",
92
+ sourcePath: "/docs",
93
+ token: "gph_YourGitHubToken"
94
+ }
95
+ }
96
+ ]
97
+ })
98
+ },
99
+ {
100
+ description: "Enables GitHub Pages for a repository with minimal configuration.",
101
+ example: yaml__default.default.stringify({
102
+ steps: [
103
+ {
104
+ action: "github:pages",
105
+ id: "github-pages-minimal",
106
+ name: "Enable GitHub Pages with Minimal Configuration",
107
+ input: {
108
+ repoUrl: "github.com?repo=minimalRepo&owner=minimalOwner",
109
+ token: "gph_YourGitHubToken"
110
+ }
111
+ }
112
+ ]
113
+ })
114
+ },
115
+ {
116
+ description: "Enables GitHub Pages for a repository with custom build type and source path.",
117
+ example: yaml__default.default.stringify({
118
+ steps: [
119
+ {
120
+ action: "github:pages",
121
+ id: "github-pages-custom-build-path",
122
+ name: "Enable GitHub Pages with Custom Build Type and Source Path",
123
+ input: {
124
+ repoUrl: "github.com?repo=customBuildPathRepo&owner=customOwner",
125
+ buildType: "legacy",
126
+ sourcePath: "/custom-path",
127
+ token: "gph_YourGitHubToken"
128
+ }
129
+ }
130
+ ]
131
+ })
132
+ },
133
+ {
134
+ description: "Enables GitHub Pages for a repository with custom source branch and path.",
135
+ example: yaml__default.default.stringify({
136
+ steps: [
137
+ {
138
+ action: "github:pages",
139
+ id: "github-pages-custom-branch-path",
140
+ name: "Enable GitHub Pages with Custom Source Branch and Path",
141
+ input: {
142
+ repoUrl: "github.com?repo=customBranchPathRepo&owner=branchPathOwner",
143
+ sourceBranch: "feature-branch",
144
+ sourcePath: "/project-docs",
145
+ token: "gph_YourGitHubToken"
146
+ }
147
+ }
148
+ ]
149
+ })
150
+ },
151
+ {
152
+ description: "Enables GitHub Pages for a repository with a custom owner and repository name.",
153
+ example: yaml__default.default.stringify({
154
+ steps: [
155
+ {
156
+ action: "github:pages",
157
+ id: "github-pages-custom-owner-repo",
158
+ name: "Enable GitHub Pages with Custom Owner and Repository Name",
159
+ input: {
160
+ repoUrl: "github.com?repo=customRepoName&owner=customOwnerName",
161
+ token: "gph_YourGitHubToken"
162
+ }
163
+ }
164
+ ]
165
+ })
166
+ },
167
+ {
168
+ description: "Enables GitHub Pages for a repository with full customization and a different token.",
169
+ example: yaml__default.default.stringify({
170
+ steps: [
171
+ {
172
+ action: "github:pages",
173
+ id: "github-pages-full-custom-diff-token",
174
+ name: "Enable GitHub Pages with Full Customization and Different Token",
175
+ input: {
176
+ repoUrl: "github.com?repo=customTokenRepo&owner=tokenOwner",
177
+ buildType: "workflow",
178
+ sourceBranch: "main",
179
+ sourcePath: "/site",
180
+ token: "gph_DifferentGitHubToken"
181
+ }
182
+ }
183
+ ]
184
+ })
185
+ },
186
+ {
187
+ description: "Enables GitHub Pages for a repository with a specific token for authorization.",
188
+ example: yaml__default.default.stringify({
189
+ steps: [
190
+ {
191
+ action: "github:pages",
192
+ id: "github-pages-specific-token",
193
+ name: "Enable GitHub Pages with Specific Token",
194
+ input: {
195
+ repoUrl: "github.com?repo=specificTokenRepo&owner=tokenOwner",
196
+ token: "gph_SpecificGitHubToken"
197
+ }
198
+ }
199
+ ]
200
+ })
201
+ },
202
+ {
203
+ description: "Enables GitHub Pages for a documentation site with custom configuration.",
204
+ example: yaml__default.default.stringify({
205
+ steps: [
206
+ {
207
+ action: "github:pages",
208
+ id: "github-pages-doc-site",
209
+ name: "Enable GitHub Pages for Documentation Site",
210
+ input: {
211
+ repoUrl: "github.com?repo=docSiteRepo&owner=docsOwner",
212
+ buildType: "workflow",
213
+ sourceBranch: "docs-branch",
214
+ sourcePath: "/docs-site",
215
+ token: "gph_DocsGitHubToken"
216
+ }
217
+ }
218
+ ]
219
+ })
220
+ }
221
+ ];
222
+
223
+ exports.examples = examples;
224
+ //# sourceMappingURL=githubPagesEnable.examples.cjs.js.map
@@ -0,0 +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,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,wCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,cAAA;AAAA,UACR,EAAI,EAAA,cAAA;AAAA,UACJ,IAAM,EAAA,qBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,SAAW,EAAA,UAAA;AAAA,YACX,YAAc,EAAA,MAAA;AAAA,YACd,UAAY,EAAA,GAAA;AAAA,YACZ,KAAO,EAAA,qBAAA;AAAA,WACT;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,kEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,cAAA;AAAA,UACR,EAAI,EAAA,0BAAA;AAAA,UACJ,IAAM,EAAA,6CAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kDAAA;AAAA,YACT,UAAY,EAAA,OAAA;AAAA,YACZ,KAAO,EAAA,qBAAA;AAAA,WACT;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,gEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,cAAA;AAAA,UACR,EAAI,EAAA,qBAAA;AAAA,UACJ,IAAM,EAAA,4CAAA;A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