@backstage/plugin-scaffolder-backend 1.15.0-next.2 → 1.15.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.15.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 84b0e47373db: Add `TargetBranchName` variable and output for the `publish:gitlab:merge-request` and `publish:github:pull-request` s'cascaffolder actions.
8
+ - 6a694ce98e32: Add a scaffolder action that pull-requests for bitbucket server
9
+ - 1948845861b0: Added `github:deployKey:create` and `github:environment:create` scaffolder actions. You will need to add `read/write` permissions to your GITHUB_TOKEN and/or Github Backstage App for Repository `Administration` (for deploy key functionality) and `Environments` (for Environment functionality)
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @backstage/backend-common@0.19.0-next.2
15
+ - @backstage/catalog-model@1.4.0-next.1
16
+ - @backstage/plugin-catalog-backend@1.10.0-next.2
17
+ - @backstage/backend-plugin-api@0.5.3-next.2
18
+ - @backstage/backend-tasks@0.5.3-next.2
19
+ - @backstage/catalog-client@1.4.2-next.2
20
+ - @backstage/config@1.0.7
21
+ - @backstage/errors@1.2.0-next.0
22
+ - @backstage/integration@1.5.0-next.0
23
+ - @backstage/types@1.0.2
24
+ - @backstage/plugin-auth-node@0.2.15-next.2
25
+ - @backstage/plugin-catalog-common@1.0.14-next.1
26
+ - @backstage/plugin-catalog-node@1.3.7-next.2
27
+ - @backstage/plugin-permission-common@0.7.6-next.0
28
+ - @backstage/plugin-permission-node@0.7.9-next.2
29
+ - @backstage/plugin-scaffolder-common@1.3.1-next.1
30
+ - @backstage/plugin-scaffolder-node@0.1.4-next.2
31
+
3
32
  ## 1.15.0-next.2
4
33
 
5
34
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.15.0-next.2",
3
+ "version": "1.15.0-next.3",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var backendPluginApi = require('@backstage/backend-plugin-api');
6
6
  var alpha = require('@backstage/plugin-catalog-node/alpha');
7
- var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-70d9fced.cjs.js');
7
+ var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-8d851e94.cjs.js');
8
8
  var alpha$1 = require('@backstage/plugin-scaffolder-common/alpha');
9
9
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
10
10
  var backendCommon = require('@backstage/backend-common');
@@ -1477,7 +1477,7 @@ async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, r
1477
1477
  name: repo,
1478
1478
  org: owner,
1479
1479
  private: repoVisibility === "private",
1480
- // @ts-ignore
1480
+ // @ts-ignore https://github.com/octokit/types.ts/issues/522
1481
1481
  visibility: repoVisibility,
1482
1482
  description,
1483
1483
  delete_branch_on_merge: deleteBranchOnMerge,
@@ -2421,6 +2421,260 @@ function createGithubWebhookAction(options) {
2421
2421
  });
2422
2422
  }
2423
2423
 
2424
+ function createGithubDeployKeyAction(options) {
2425
+ const { integrations } = options;
2426
+ return pluginScaffolderNode.createTemplateAction({
2427
+ id: "github:deployKey:create",
2428
+ description: "Creates and stores Deploy Keys",
2429
+ schema: {
2430
+ input: {
2431
+ type: "object",
2432
+ required: ["repoUrl", "publicKey", "privateKey", "deployKeyName"],
2433
+ properties: {
2434
+ repoUrl: {
2435
+ title: "Repository Location",
2436
+ description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`,
2437
+ type: "string"
2438
+ },
2439
+ publicKey: {
2440
+ title: "SSH Public Key",
2441
+ description: `Generated from ssh-keygen. Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.`,
2442
+ type: "string"
2443
+ },
2444
+ privateKey: {
2445
+ title: "SSH Private Key",
2446
+ description: `SSH Private Key generated from ssh-keygen`,
2447
+ type: "string"
2448
+ },
2449
+ deployKeyName: {
2450
+ title: "Deploy Key Name",
2451
+ description: `Name of the Deploy Key`,
2452
+ type: "string"
2453
+ },
2454
+ privateKeySecretName: {
2455
+ title: "Private Key GitHub Secret Name",
2456
+ description: `Name of the GitHub Secret to store the private key related to the Deploy Key. Defaults to: 'KEY_NAME_PRIVATE_KEY' where 'KEY_NAME' is the name of the Deploy Key`,
2457
+ type: "string"
2458
+ },
2459
+ token: {
2460
+ title: "Authentication Token",
2461
+ type: "string",
2462
+ description: "The token to use for authorization to GitHub"
2463
+ }
2464
+ }
2465
+ },
2466
+ output: {
2467
+ type: "object",
2468
+ properties: {
2469
+ privateKeySecretName: {
2470
+ title: "The GitHub Action Repo Secret Name for the Private Key",
2471
+ type: "string"
2472
+ }
2473
+ }
2474
+ }
2475
+ },
2476
+ async handler(ctx) {
2477
+ const {
2478
+ repoUrl,
2479
+ publicKey,
2480
+ privateKey,
2481
+ deployKeyName,
2482
+ privateKeySecretName = `${deployKeyName.split(" ").join("_").toLocaleUpperCase("en-US")}_PRIVATE_KEY`,
2483
+ token: providedToken
2484
+ } = ctx.input;
2485
+ const octokitOptions = await getOctokitOptions({
2486
+ integrations,
2487
+ token: providedToken,
2488
+ repoUrl
2489
+ });
2490
+ const { owner, repo } = parseRepoUrl(repoUrl, integrations);
2491
+ if (!owner) {
2492
+ throw new errors.InputError(`No owner provided for repo ${repoUrl}`);
2493
+ }
2494
+ const client = new octokit.Octokit(octokitOptions);
2495
+ await client.rest.repos.createDeployKey({
2496
+ owner,
2497
+ repo,
2498
+ title: deployKeyName,
2499
+ key: publicKey
2500
+ });
2501
+ const publicKeyResponse = await client.rest.actions.getRepoPublicKey({
2502
+ owner,
2503
+ repo
2504
+ });
2505
+ await Sodium__default["default"].ready;
2506
+ const binaryKey = Sodium__default["default"].from_base64(
2507
+ publicKeyResponse.data.key,
2508
+ Sodium__default["default"].base64_variants.ORIGINAL
2509
+ );
2510
+ const binarySecret = Sodium__default["default"].from_string(privateKey);
2511
+ const encryptedBinarySecret = Sodium__default["default"].crypto_box_seal(
2512
+ binarySecret,
2513
+ binaryKey
2514
+ );
2515
+ const encryptedBase64Secret = Sodium__default["default"].to_base64(
2516
+ encryptedBinarySecret,
2517
+ Sodium__default["default"].base64_variants.ORIGINAL
2518
+ );
2519
+ await client.rest.actions.createOrUpdateRepoSecret({
2520
+ owner,
2521
+ repo,
2522
+ secret_name: privateKeySecretName,
2523
+ encrypted_value: encryptedBase64Secret,
2524
+ key_id: publicKeyResponse.data.key_id
2525
+ });
2526
+ ctx.output("privateKeySecretName", privateKeySecretName);
2527
+ }
2528
+ });
2529
+ }
2530
+
2531
+ function createGithubEnvironmentAction(options) {
2532
+ const { integrations } = options;
2533
+ return pluginScaffolderNode.createTemplateAction({
2534
+ id: "github:environment:create",
2535
+ description: "Creates Deployment Environments",
2536
+ schema: {
2537
+ input: {
2538
+ type: "object",
2539
+ required: ["repoUrl", "name"],
2540
+ properties: {
2541
+ repoUrl: {
2542
+ title: "Repository Location",
2543
+ description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`,
2544
+ type: "string"
2545
+ },
2546
+ name: {
2547
+ title: "Environment Name",
2548
+ description: `Name of the deployment environment to create`,
2549
+ type: "string"
2550
+ },
2551
+ deploymentBranchPolicy: {
2552
+ title: "Deployment Branch Policy",
2553
+ description: `The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.`,
2554
+ type: "object",
2555
+ required: ["protected_branches", "custom_branch_policies"],
2556
+ properties: {
2557
+ protected_branches: {
2558
+ title: "Protected Branches",
2559
+ 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.`,
2560
+ type: "boolean"
2561
+ },
2562
+ custom_branch_policies: {
2563
+ title: "Custom Branch Policies",
2564
+ 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.`,
2565
+ type: "boolean"
2566
+ }
2567
+ }
2568
+ },
2569
+ customBranchPolicyNames: {
2570
+ title: "Custom Branch Policy Name",
2571
+ description: `The name pattern that branches must match in order to deploy to the environment.
2572
+
2573
+ 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.`,
2574
+ type: "array",
2575
+ items: {
2576
+ type: "string"
2577
+ }
2578
+ },
2579
+ environmentVariables: {
2580
+ title: "Environment Variables",
2581
+ description: `Environment variables attached to the deployment environment`,
2582
+ type: "object"
2583
+ },
2584
+ secrets: {
2585
+ title: "Deployment Secrets",
2586
+ description: `Secrets attached to the deployment environment`,
2587
+ type: "object"
2588
+ },
2589
+ token: {
2590
+ title: "Authentication Token",
2591
+ type: "string",
2592
+ description: "The token to use for authorization to GitHub"
2593
+ }
2594
+ }
2595
+ }
2596
+ },
2597
+ async handler(ctx) {
2598
+ const {
2599
+ repoUrl,
2600
+ name,
2601
+ deploymentBranchPolicy,
2602
+ customBranchPolicyNames,
2603
+ environmentVariables,
2604
+ secrets,
2605
+ token: providedToken
2606
+ } = ctx.input;
2607
+ const octokitOptions = await getOctokitOptions({
2608
+ integrations,
2609
+ token: providedToken,
2610
+ repoUrl
2611
+ });
2612
+ const { owner, repo } = parseRepoUrl(repoUrl, integrations);
2613
+ if (!owner) {
2614
+ throw new errors.InputError(`No owner provided for repo ${repoUrl}`);
2615
+ }
2616
+ const client = new octokit.Octokit(octokitOptions);
2617
+ const repository = await client.rest.repos.get({
2618
+ owner,
2619
+ repo
2620
+ });
2621
+ await client.rest.repos.createOrUpdateEnvironment({
2622
+ owner,
2623
+ repo,
2624
+ environment_name: name,
2625
+ deployment_branch_policy: deploymentBranchPolicy != null ? deploymentBranchPolicy : null
2626
+ });
2627
+ if (customBranchPolicyNames) {
2628
+ for (const item of customBranchPolicyNames) {
2629
+ await client.rest.repos.createDeploymentBranchPolicy({
2630
+ owner,
2631
+ repo,
2632
+ environment_name: name,
2633
+ name: item
2634
+ });
2635
+ }
2636
+ }
2637
+ for (const [key, value] of Object.entries(environmentVariables != null ? environmentVariables : {})) {
2638
+ await client.rest.actions.createEnvironmentVariable({
2639
+ repository_id: repository.data.id,
2640
+ environment_name: name,
2641
+ name: key,
2642
+ value
2643
+ });
2644
+ }
2645
+ if (secrets) {
2646
+ const publicKeyResponse = await client.rest.actions.getRepoPublicKey({
2647
+ owner,
2648
+ repo
2649
+ });
2650
+ await Sodium__default["default"].ready;
2651
+ const binaryKey = Sodium__default["default"].from_base64(
2652
+ publicKeyResponse.data.key,
2653
+ Sodium__default["default"].base64_variants.ORIGINAL
2654
+ );
2655
+ for (const [key, value] of Object.entries(secrets)) {
2656
+ const binarySecret = Sodium__default["default"].from_string(value);
2657
+ const encryptedBinarySecret = Sodium__default["default"].crypto_box_seal(
2658
+ binarySecret,
2659
+ binaryKey
2660
+ );
2661
+ const encryptedBase64Secret = Sodium__default["default"].to_base64(
2662
+ encryptedBinarySecret,
2663
+ Sodium__default["default"].base64_variants.ORIGINAL
2664
+ );
2665
+ await client.rest.actions.createOrUpdateEnvironmentSecret({
2666
+ repository_id: repository.data.id,
2667
+ environment_name: name,
2668
+ secret_name: key,
2669
+ encrypted_value: encryptedBase64Secret,
2670
+ key_id: publicKeyResponse.data.key_id
2671
+ });
2672
+ }
2673
+ }
2674
+ }
2675
+ });
2676
+ }
2677
+
2424
2678
  function createPublishAzureAction(options) {
2425
2679
  const { integrations, config } = options;
2426
2680
  return pluginScaffolderNode.createTemplateAction({
@@ -3273,6 +3527,203 @@ function createPublishBitbucketServerAction(options) {
3273
3527
  });
3274
3528
  }
3275
3529
 
3530
+ const createPullRequest = async (opts) => {
3531
+ const {
3532
+ project,
3533
+ repo,
3534
+ title,
3535
+ description,
3536
+ toRef,
3537
+ fromRef,
3538
+ authorization,
3539
+ apiBaseUrl
3540
+ } = opts;
3541
+ let response;
3542
+ const data = {
3543
+ method: "POST",
3544
+ body: JSON.stringify({
3545
+ title,
3546
+ description,
3547
+ state: "OPEN",
3548
+ open: true,
3549
+ closed: false,
3550
+ locked: true,
3551
+ toRef,
3552
+ fromRef
3553
+ }),
3554
+ headers: {
3555
+ Authorization: authorization,
3556
+ "Content-Type": "application/json"
3557
+ }
3558
+ };
3559
+ try {
3560
+ response = await fetch__default["default"](
3561
+ `${apiBaseUrl}/projects/${encodeURIComponent(
3562
+ project
3563
+ )}/repos/${encodeURIComponent(repo)}/pull-requests`,
3564
+ data
3565
+ );
3566
+ } catch (e) {
3567
+ throw new Error(`Unable to create pull-reqeusts, ${e}`);
3568
+ }
3569
+ if (response.status !== 201) {
3570
+ throw new Error(
3571
+ `Unable to create pull requests, ${response.status} ${response.statusText}, ${await response.text()}`
3572
+ );
3573
+ }
3574
+ const r = await response.json();
3575
+ return `${r.links.self[0].href}`;
3576
+ };
3577
+ const findBranches = async (opts) => {
3578
+ const { project, repo, branchName, authorization, apiBaseUrl } = opts;
3579
+ let response;
3580
+ const options = {
3581
+ method: "GET",
3582
+ headers: {
3583
+ Authorization: authorization,
3584
+ "Content-Type": "application/json"
3585
+ }
3586
+ };
3587
+ try {
3588
+ response = await fetch__default["default"](
3589
+ `${apiBaseUrl}/projects/${encodeURIComponent(
3590
+ project
3591
+ )}/repos/${encodeURIComponent(
3592
+ repo
3593
+ )}/branches?boostMatches=true&filterText=${encodeURIComponent(
3594
+ branchName
3595
+ )}`,
3596
+ options
3597
+ );
3598
+ } catch (e) {
3599
+ throw new Error(`Unable to get branches, ${e}`);
3600
+ }
3601
+ if (response.status !== 200) {
3602
+ throw new Error(
3603
+ `Unable to get branches, ${response.status} ${response.statusText}, ${await response.text()}`
3604
+ );
3605
+ }
3606
+ const r = await response.json();
3607
+ for (const object of r.values) {
3608
+ if (object.displayId === branchName) {
3609
+ return object;
3610
+ }
3611
+ }
3612
+ return void 0;
3613
+ };
3614
+ function createPublishBitbucketServerPullRequestAction(options) {
3615
+ const { integrations } = options;
3616
+ return pluginScaffolderNode.createTemplateAction({
3617
+ id: "publish:bitbucketServer:pull-request",
3618
+ schema: {
3619
+ input: {
3620
+ type: "object",
3621
+ required: ["repoUrl", "title", "sourceBranch"],
3622
+ properties: {
3623
+ repoUrl: {
3624
+ title: "Repository Location",
3625
+ type: "string"
3626
+ },
3627
+ title: {
3628
+ title: "Pull Request title",
3629
+ type: "string",
3630
+ description: "The title for the pull request"
3631
+ },
3632
+ description: {
3633
+ title: "Pull Request Description",
3634
+ type: "string",
3635
+ description: "The description of the pull request"
3636
+ },
3637
+ targetBranch: {
3638
+ title: "Target Branch",
3639
+ type: "string",
3640
+ description: `Branch of repository to apply changes to. The default value is 'master'`
3641
+ },
3642
+ sourceBranch: {
3643
+ title: "Source Branch",
3644
+ type: "string",
3645
+ description: "Branch of repository to copy changes from"
3646
+ },
3647
+ token: {
3648
+ title: "Authorization Token",
3649
+ type: "string",
3650
+ description: "The token to use for authorization to BitBucket Server"
3651
+ }
3652
+ }
3653
+ },
3654
+ output: {
3655
+ type: "object",
3656
+ properties: {
3657
+ pullRequestUrl: {
3658
+ title: "A URL to the pull request with the provider",
3659
+ type: "string"
3660
+ }
3661
+ }
3662
+ }
3663
+ },
3664
+ async handler(ctx) {
3665
+ var _a;
3666
+ const {
3667
+ repoUrl,
3668
+ title,
3669
+ description,
3670
+ targetBranch = "master",
3671
+ sourceBranch
3672
+ } = ctx.input;
3673
+ const { project, repo, host } = parseRepoUrl(repoUrl, integrations);
3674
+ if (!project) {
3675
+ throw new errors.InputError(
3676
+ `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing project`
3677
+ );
3678
+ }
3679
+ const integrationConfig = integrations.bitbucketServer.byHost(host);
3680
+ if (!integrationConfig) {
3681
+ throw new errors.InputError(
3682
+ `No matching integration configuration for host ${host}, please check your integrations config`
3683
+ );
3684
+ }
3685
+ const token = (_a = ctx.input.token) != null ? _a : integrationConfig.config.token;
3686
+ const authConfig = {
3687
+ ...integrationConfig.config,
3688
+ ...{ token }
3689
+ };
3690
+ const reqOpts = integration.getBitbucketServerRequestOptions(authConfig);
3691
+ const authorization = reqOpts.headers.Authorization;
3692
+ if (!authorization) {
3693
+ throw new Error(
3694
+ `Authorization has not been provided for ${integrationConfig.config.host}. Please add either (a) a user login auth token, or (b) a token input from the template or (c) username + password to the integration config.`
3695
+ );
3696
+ }
3697
+ const apiBaseUrl = integrationConfig.config.apiBaseUrl;
3698
+ const toRef = await findBranches({
3699
+ project,
3700
+ repo,
3701
+ branchName: targetBranch,
3702
+ authorization,
3703
+ apiBaseUrl
3704
+ });
3705
+ const fromRef = await findBranches({
3706
+ project,
3707
+ repo,
3708
+ branchName: sourceBranch,
3709
+ authorization,
3710
+ apiBaseUrl
3711
+ });
3712
+ const pullRequestUrl = await createPullRequest({
3713
+ project,
3714
+ repo,
3715
+ title,
3716
+ description,
3717
+ toRef,
3718
+ fromRef,
3719
+ authorization,
3720
+ apiBaseUrl
3721
+ });
3722
+ ctx.output("pullRequestUrl", pullRequestUrl);
3723
+ }
3724
+ });
3725
+ }
3726
+
3276
3727
  const createGerritProject = async (config, options) => {
3277
3728
  const { projectName, parent, owner, description } = options;
3278
3729
  const fetchOptions = {
@@ -3811,6 +4262,11 @@ const createPublishGithubPullRequestAction = (options) => {
3811
4262
  title: "Branch Name",
3812
4263
  description: "The name for the branch"
3813
4264
  },
4265
+ targetBranchName: {
4266
+ type: "string",
4267
+ title: "Target Branch Name",
4268
+ description: "The target branch name of the merge request"
4269
+ },
3814
4270
  title: {
3815
4271
  type: "string",
3816
4272
  title: "Pull Request Name",
@@ -3868,6 +4324,10 @@ const createPublishGithubPullRequestAction = (options) => {
3868
4324
  required: ["remoteUrl"],
3869
4325
  type: "object",
3870
4326
  properties: {
4327
+ targetBranchName: {
4328
+ title: "Target branch name of the merge request",
4329
+ type: "string"
4330
+ },
3871
4331
  remoteUrl: {
3872
4332
  type: "string",
3873
4333
  title: "Pull Request URL",
@@ -3885,6 +4345,7 @@ const createPublishGithubPullRequestAction = (options) => {
3885
4345
  const {
3886
4346
  repoUrl,
3887
4347
  branchName,
4348
+ targetBranchName,
3888
4349
  title,
3889
4350
  description,
3890
4351
  draft,
@@ -3941,7 +4402,7 @@ const createPublishGithubPullRequestAction = (options) => {
3941
4402
  ])
3942
4403
  );
3943
4404
  try {
3944
- const response = await client.createPullRequest({
4405
+ const createOptions = {
3945
4406
  owner,
3946
4407
  repo,
3947
4408
  title,
@@ -3954,7 +4415,11 @@ const createPublishGithubPullRequestAction = (options) => {
3954
4415
  body: description,
3955
4416
  head: branchName,
3956
4417
  draft
3957
- });
4418
+ };
4419
+ if (targetBranchName) {
4420
+ createOptions.base = targetBranchName;
4421
+ }
4422
+ const response = await client.createPullRequest(createOptions);
3958
4423
  if (!response) {
3959
4424
  throw new GithubResponseError("null response from Github");
3960
4425
  }
@@ -3969,6 +4434,8 @@ const createPublishGithubPullRequestAction = (options) => {
3969
4434
  ctx.logger
3970
4435
  );
3971
4436
  }
4437
+ const targetBranch = response.data.base.ref;
4438
+ ctx.output("targetBranchName", targetBranch);
3972
4439
  ctx.output("remoteUrl", response.data.html_url);
3973
4440
  ctx.output("pullRequestNumber", pullRequestNumber);
3974
4441
  } catch (e) {
@@ -4195,8 +4662,13 @@ const createPublishGitlabMergeRequestAction = (options) => {
4195
4662
  },
4196
4663
  branchName: {
4197
4664
  type: "string",
4198
- title: "Destination Branch name",
4199
- description: "The description of the merge request"
4665
+ title: "Source Branch Name",
4666
+ description: "The source branch name of the merge request"
4667
+ },
4668
+ targetBranchName: {
4669
+ type: "string",
4670
+ title: "Target Branch Name",
4671
+ description: "The target branch name of the merge request"
4200
4672
  },
4201
4673
  sourcePath: {
4202
4674
  type: "string",
@@ -4234,6 +4706,10 @@ const createPublishGitlabMergeRequestAction = (options) => {
4234
4706
  output: {
4235
4707
  type: "object",
4236
4708
  properties: {
4709
+ targetBranchName: {
4710
+ title: "Target branch name of the merge request",
4711
+ type: "string"
4712
+ },
4237
4713
  projectid: {
4238
4714
  title: "Gitlab Project id/Name(slug)",
4239
4715
  type: "string"
@@ -4254,6 +4730,7 @@ const createPublishGitlabMergeRequestAction = (options) => {
4254
4730
  const {
4255
4731
  assignee,
4256
4732
  branchName,
4733
+ targetBranchName,
4257
4734
  description,
4258
4735
  repoUrl,
4259
4736
  removeSourceBranch,
@@ -4314,10 +4791,14 @@ const createPublishGitlabMergeRequestAction = (options) => {
4314
4791
  execute_filemode: file.executable
4315
4792
  };
4316
4793
  });
4317
- const projects = await api.Projects.show(repoID);
4318
- const { default_branch: defaultBranch } = projects;
4794
+ let targetBranch = targetBranchName;
4795
+ if (!targetBranch) {
4796
+ const projects = await api.Projects.show(repoID);
4797
+ const { default_branch: defaultBranch } = projects;
4798
+ targetBranch = defaultBranch;
4799
+ }
4319
4800
  try {
4320
- await api.Branches.create(repoID, branchName, String(defaultBranch));
4801
+ await api.Branches.create(repoID, branchName, String(targetBranch));
4321
4802
  } catch (e) {
4322
4803
  throw new errors.InputError(
4323
4804
  `The branch creation failed. Please check that your repo does not already contain a branch named '${branchName}'. ${e}`
@@ -4334,7 +4815,7 @@ const createPublishGitlabMergeRequestAction = (options) => {
4334
4815
  const mergeRequestUrl = await api.MergeRequests.create(
4335
4816
  repoID,
4336
4817
  branchName,
4337
- String(defaultBranch),
4818
+ String(targetBranch),
4338
4819
  title,
4339
4820
  {
4340
4821
  description,
@@ -4345,6 +4826,7 @@ const createPublishGitlabMergeRequestAction = (options) => {
4345
4826
  return mergeRequest.web_url;
4346
4827
  });
4347
4828
  ctx.output("projectid", repoID);
4829
+ ctx.output("targetBranchName", targetBranch);
4348
4830
  ctx.output("projectPath", repoID);
4349
4831
  ctx.output("mergeRequestUrl", mergeRequestUrl);
4350
4832
  } catch (e) {
@@ -4415,6 +4897,10 @@ const createBuiltinActions = (options) => {
4415
4897
  integrations,
4416
4898
  config
4417
4899
  }),
4900
+ createPublishBitbucketServerPullRequestAction({
4901
+ integrations,
4902
+ config
4903
+ }),
4418
4904
  createPublishAzureAction({
4419
4905
  integrations,
4420
4906
  config
@@ -4446,6 +4932,12 @@ const createBuiltinActions = (options) => {
4446
4932
  integrations,
4447
4933
  config,
4448
4934
  githubCredentialsProvider
4935
+ }),
4936
+ createGithubEnvironmentAction({
4937
+ integrations
4938
+ }),
4939
+ createGithubDeployKeyAction({
4940
+ integrations
4449
4941
  })
4450
4942
  ];
4451
4943
  return actions;
@@ -6225,6 +6717,8 @@ exports.createFetchTemplateAction = createFetchTemplateAction;
6225
6717
  exports.createFilesystemDeleteAction = createFilesystemDeleteAction;
6226
6718
  exports.createFilesystemRenameAction = createFilesystemRenameAction;
6227
6719
  exports.createGithubActionsDispatchAction = createGithubActionsDispatchAction;
6720
+ exports.createGithubDeployKeyAction = createGithubDeployKeyAction;
6721
+ exports.createGithubEnvironmentAction = createGithubEnvironmentAction;
6228
6722
  exports.createGithubIssuesLabelAction = createGithubIssuesLabelAction;
6229
6723
  exports.createGithubRepoCreateAction = createGithubRepoCreateAction;
6230
6724
  exports.createGithubRepoPushAction = createGithubRepoPushAction;
@@ -6233,6 +6727,7 @@ exports.createPublishAzureAction = createPublishAzureAction;
6233
6727
  exports.createPublishBitbucketAction = createPublishBitbucketAction;
6234
6728
  exports.createPublishBitbucketCloudAction = createPublishBitbucketCloudAction;
6235
6729
  exports.createPublishBitbucketServerAction = createPublishBitbucketServerAction;
6730
+ exports.createPublishBitbucketServerPullRequestAction = createPublishBitbucketServerPullRequestAction;
6236
6731
  exports.createPublishGerritAction = createPublishGerritAction;
6237
6732
  exports.createPublishGerritReviewAction = createPublishGerritReviewAction;
6238
6733
  exports.createPublishGithubAction = createPublishGithubAction;
@@ -6245,4 +6740,4 @@ exports.executeShellCommand = executeShellCommand;
6245
6740
  exports.fetchContents = fetchContents;
6246
6741
  exports.scaffolderActionRules = scaffolderActionRules;
6247
6742
  exports.scaffolderTemplateRules = scaffolderTemplateRules;
6248
- //# sourceMappingURL=ScaffolderEntitiesProcessor-70d9fced.cjs.js.map
6743
+ //# sourceMappingURL=ScaffolderEntitiesProcessor-8d851e94.cjs.js.map