@backstage/plugin-scaffolder-backend 1.8.0-next.1 → 1.8.0-next.2

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,30 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.8.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 5025d2e8b6: Adds the ability to pass (an optional) array of strings that will be applied to the newly scaffolded repository as topic labels.
8
+
9
+ ### Patch Changes
10
+
11
+ - 969a8444ea: Updated dependency `esbuild` to `^0.15.0`.
12
+ - 9ff4ff3745: Implement "Branch protection rules" support for "publish:github" action
13
+ - Updated dependencies
14
+ - @backstage/backend-common@0.16.0-next.1
15
+ - @backstage/backend-plugin-api@0.1.4-next.1
16
+ - @backstage/backend-tasks@0.3.7-next.1
17
+ - @backstage/plugin-auth-node@0.2.7-next.1
18
+ - @backstage/plugin-catalog-backend@1.5.1-next.1
19
+ - @backstage/plugin-catalog-node@1.2.1-next.1
20
+ - @backstage/catalog-client@1.1.2-next.0
21
+ - @backstage/catalog-model@1.1.3-next.0
22
+ - @backstage/config@1.0.4-next.0
23
+ - @backstage/errors@1.1.3-next.0
24
+ - @backstage/integration@1.4.0-next.0
25
+ - @backstage/types@1.0.1-next.0
26
+ - @backstage/plugin-scaffolder-common@1.2.2-next.0
27
+
3
28
  ## 1.8.0-next.1
4
29
 
5
30
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.8.0-next.1",
3
+ "version": "1.8.0-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -292,6 +292,11 @@ allowSquashMerge?: boolean | undefined;
292
292
  allowMergeCommit?: boolean | undefined;
293
293
  allowAutoMerge?: boolean | undefined;
294
294
  requireCodeOwnerReviews?: boolean | undefined;
295
+ bypassPullRequestAllowances?: {
296
+ users?: string[] | undefined;
297
+ teams?: string[] | undefined;
298
+ apps?: string[] | undefined;
299
+ } | undefined;
295
300
  requiredStatusCheckContexts?: string[] | undefined;
296
301
  requireBranchesToBeUpToDate?: boolean | undefined;
297
302
  repoVisibility?: "internal" | "private" | "public" | undefined;
@@ -330,6 +335,11 @@ gitCommitMessage?: string | undefined;
330
335
  gitAuthorName?: string | undefined;
331
336
  gitAuthorEmail?: string | undefined;
332
337
  requireCodeOwnerReviews?: boolean | undefined;
338
+ bypassPullRequestAllowances?: {
339
+ users?: string[];
340
+ teams?: string[];
341
+ apps?: string[];
342
+ } | undefined;
333
343
  requiredStatusCheckContexts?: string[] | undefined;
334
344
  requireBranchesToBeUpToDate?: boolean | undefined;
335
345
  sourcePath?: string | undefined;
@@ -492,6 +502,11 @@ allowSquashMerge?: boolean | undefined;
492
502
  allowMergeCommit?: boolean | undefined;
493
503
  allowAutoMerge?: boolean | undefined;
494
504
  sourcePath?: string | undefined;
505
+ bypassPullRequestAllowances?: {
506
+ users?: string[];
507
+ teams?: string[];
508
+ apps?: string[];
509
+ } | undefined;
495
510
  requireCodeOwnerReviews?: boolean | undefined;
496
511
  requiredStatusCheckContexts?: string[] | undefined;
497
512
  requireBranchesToBeUpToDate?: boolean | undefined;
@@ -547,6 +562,7 @@ gitCommitMessage?: string | undefined;
547
562
  gitAuthorName?: string | undefined;
548
563
  gitAuthorEmail?: string | undefined;
549
564
  setUserAsOwner?: boolean | undefined;
565
+ topics?: string[] | undefined;
550
566
  }>;
551
567
 
552
568
  /**
@@ -292,6 +292,11 @@ allowSquashMerge?: boolean | undefined;
292
292
  allowMergeCommit?: boolean | undefined;
293
293
  allowAutoMerge?: boolean | undefined;
294
294
  requireCodeOwnerReviews?: boolean | undefined;
295
+ bypassPullRequestAllowances?: {
296
+ users?: string[] | undefined;
297
+ teams?: string[] | undefined;
298
+ apps?: string[] | undefined;
299
+ } | undefined;
295
300
  requiredStatusCheckContexts?: string[] | undefined;
296
301
  requireBranchesToBeUpToDate?: boolean | undefined;
297
302
  repoVisibility?: "internal" | "private" | "public" | undefined;
@@ -330,6 +335,11 @@ gitCommitMessage?: string | undefined;
330
335
  gitAuthorName?: string | undefined;
331
336
  gitAuthorEmail?: string | undefined;
332
337
  requireCodeOwnerReviews?: boolean | undefined;
338
+ bypassPullRequestAllowances?: {
339
+ users?: string[];
340
+ teams?: string[];
341
+ apps?: string[];
342
+ } | undefined;
333
343
  requiredStatusCheckContexts?: string[] | undefined;
334
344
  requireBranchesToBeUpToDate?: boolean | undefined;
335
345
  sourcePath?: string | undefined;
@@ -492,6 +502,11 @@ allowSquashMerge?: boolean | undefined;
492
502
  allowMergeCommit?: boolean | undefined;
493
503
  allowAutoMerge?: boolean | undefined;
494
504
  sourcePath?: string | undefined;
505
+ bypassPullRequestAllowances?: {
506
+ users?: string[];
507
+ teams?: string[];
508
+ apps?: string[];
509
+ } | undefined;
495
510
  requireCodeOwnerReviews?: boolean | undefined;
496
511
  requiredStatusCheckContexts?: string[] | undefined;
497
512
  requireBranchesToBeUpToDate?: boolean | undefined;
@@ -547,6 +562,7 @@ gitCommitMessage?: string | undefined;
547
562
  gitAuthorName?: string | undefined;
548
563
  gitAuthorEmail?: string | undefined;
549
564
  setUserAsOwner?: boolean | undefined;
565
+ topics?: string[] | undefined;
550
566
  }>;
551
567
 
552
568
  /**
package/dist/index.cjs.js CHANGED
@@ -993,6 +993,7 @@ const enableBranchProtectionOnDefaultRepoBranch = async ({
993
993
  owner,
994
994
  logger,
995
995
  requireCodeOwnerReviews,
996
+ bypassPullRequestAllowances,
996
997
  requiredStatusCheckContexts = [],
997
998
  requireBranchesToBeUpToDate = true,
998
999
  defaultBranch = "master",
@@ -1015,7 +1016,8 @@ const enableBranchProtectionOnDefaultRepoBranch = async ({
1015
1016
  enforce_admins: enforceAdmins,
1016
1017
  required_pull_request_reviews: {
1017
1018
  required_approving_review_count: 1,
1018
- require_code_owner_reviews: requireCodeOwnerReviews
1019
+ require_code_owner_reviews: requireCodeOwnerReviews,
1020
+ bypass_pull_request_allowances: bypassPullRequestAllowances
1019
1021
  }
1020
1022
  });
1021
1023
  } catch (e) {
@@ -1182,7 +1184,7 @@ async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, r
1182
1184
  }
1183
1185
  return newRepo;
1184
1186
  }
1185
- async function initRepoPushAndProtect(remoteUrl, password, workspacePath, sourcePath, defaultBranch, protectDefaultBranch, protectEnforceAdmins, owner, client, repo, requireCodeOwnerReviews, requiredStatusCheckContexts, requireBranchesToBeUpToDate, config, logger, gitCommitMessage, gitAuthorName, gitAuthorEmail) {
1187
+ async function initRepoPushAndProtect(remoteUrl, password, workspacePath, sourcePath, defaultBranch, protectDefaultBranch, protectEnforceAdmins, owner, client, repo, requireCodeOwnerReviews, bypassPullRequestAllowances, requiredStatusCheckContexts, requireBranchesToBeUpToDate, config, logger, gitCommitMessage, gitAuthorName, gitAuthorEmail) {
1186
1188
  const gitAuthorInfo = {
1187
1189
  name: gitAuthorName ? gitAuthorName : config.getOptionalString("scaffolder.defaultAuthor.name"),
1188
1190
  email: gitAuthorEmail ? gitAuthorEmail : config.getOptionalString("scaffolder.defaultAuthor.email")
@@ -1208,6 +1210,7 @@ async function initRepoPushAndProtect(remoteUrl, password, workspacePath, source
1208
1210
  repoName: repo,
1209
1211
  logger,
1210
1212
  defaultBranch,
1213
+ bypassPullRequestAllowances,
1211
1214
  requireCodeOwnerReviews,
1212
1215
  requiredStatusCheckContexts,
1213
1216
  requireBranchesToBeUpToDate,
@@ -1499,6 +1502,32 @@ const protectEnforceAdmins = {
1499
1502
  type: "boolean",
1500
1503
  description: `Enforce admins to adhere to default branch protection. The default value is 'true'`
1501
1504
  };
1505
+ const bypassPullRequestAllowances = {
1506
+ title: "Bypass pull request requirements",
1507
+ description: "Allow specific users, teams, or apps to bypass pull request requirements.",
1508
+ type: "object",
1509
+ additionalProperties: false,
1510
+ properties: {
1511
+ apps: {
1512
+ type: "array",
1513
+ items: {
1514
+ type: "string"
1515
+ }
1516
+ },
1517
+ users: {
1518
+ type: "array",
1519
+ items: {
1520
+ type: "string"
1521
+ }
1522
+ },
1523
+ teams: {
1524
+ type: "array",
1525
+ items: {
1526
+ type: "string"
1527
+ }
1528
+ }
1529
+ }
1530
+ };
1502
1531
  const gitCommitMessage = {
1503
1532
  title: "Git Commit Message",
1504
1533
  type: "string",
@@ -1534,6 +1563,7 @@ function createGithubRepoCreateAction(options) {
1534
1563
  homepage: homepage,
1535
1564
  access: access,
1536
1565
  requireCodeOwnerReviews: requireCodeOwnerReviews,
1566
+ bypassPullRequestAllowances: bypassPullRequestAllowances,
1537
1567
  requiredStatusCheckContexts: requiredStatusCheckContexts,
1538
1568
  requireBranchesToBeUpToDate: requireBranchesToBeUpToDate,
1539
1569
  repoVisibility: repoVisibility,
@@ -1617,6 +1647,7 @@ function createGithubRepoPushAction(options) {
1617
1647
  repoUrl: repoUrl,
1618
1648
  requireCodeOwnerReviews: requireCodeOwnerReviews,
1619
1649
  requiredStatusCheckContexts: requiredStatusCheckContexts,
1650
+ bypassPullRequestAllowances: bypassPullRequestAllowances,
1620
1651
  requireBranchesToBeUpToDate: requireBranchesToBeUpToDate,
1621
1652
  defaultBranch: defaultBranch,
1622
1653
  protectDefaultBranch: protectDefaultBranch,
@@ -1646,6 +1677,7 @@ function createGithubRepoPushAction(options) {
1646
1677
  gitAuthorName,
1647
1678
  gitAuthorEmail,
1648
1679
  requireCodeOwnerReviews = false,
1680
+ bypassPullRequestAllowances,
1649
1681
  requiredStatusCheckContexts = [],
1650
1682
  requireBranchesToBeUpToDate = true,
1651
1683
  token: providedToken
@@ -1676,6 +1708,7 @@ function createGithubRepoPushAction(options) {
1676
1708
  client,
1677
1709
  repo,
1678
1710
  requireCodeOwnerReviews,
1711
+ bypassPullRequestAllowances,
1679
1712
  requiredStatusCheckContexts,
1680
1713
  requireBranchesToBeUpToDate,
1681
1714
  config,
@@ -2894,6 +2927,7 @@ function createPublishGithubAction(options) {
2894
2927
  description: description,
2895
2928
  homepage: homepage,
2896
2929
  access: access,
2930
+ bypassPullRequestAllowances: bypassPullRequestAllowances,
2897
2931
  requireCodeOwnerReviews: requireCodeOwnerReviews,
2898
2932
  requiredStatusCheckContexts: requiredStatusCheckContexts,
2899
2933
  requireBranchesToBeUpToDate: requireBranchesToBeUpToDate,
@@ -2930,6 +2964,7 @@ function createPublishGithubAction(options) {
2930
2964
  homepage,
2931
2965
  access,
2932
2966
  requireCodeOwnerReviews = false,
2967
+ bypassPullRequestAllowances,
2933
2968
  requiredStatusCheckContexts = [],
2934
2969
  requireBranchesToBeUpToDate = true,
2935
2970
  repoVisibility = "private",
@@ -2990,6 +3025,7 @@ function createPublishGithubAction(options) {
2990
3025
  client,
2991
3026
  repo,
2992
3027
  requireCodeOwnerReviews,
3028
+ bypassPullRequestAllowances,
2993
3029
  requiredStatusCheckContexts,
2994
3030
  requireBranchesToBeUpToDate,
2995
3031
  config,
@@ -3340,6 +3376,14 @@ function createPublishGitlabAction(options) {
3340
3376
  title: "Set User As Owner",
3341
3377
  type: "boolean",
3342
3378
  description: "Set the token user as owner of the newly created repository. Requires a token authorized to do the edit in the integration configuration for the matching host"
3379
+ },
3380
+ topics: {
3381
+ title: "Topic labels",
3382
+ description: "Topic labels to apply on the repository.",
3383
+ type: "array",
3384
+ items: {
3385
+ type: "string"
3386
+ }
3343
3387
  }
3344
3388
  }
3345
3389
  },
@@ -3369,7 +3413,8 @@ function createPublishGitlabAction(options) {
3369
3413
  gitCommitMessage = "initial commit",
3370
3414
  gitAuthorName,
3371
3415
  gitAuthorEmail,
3372
- setUserAsOwner = false
3416
+ setUserAsOwner = false,
3417
+ topics = []
3373
3418
  } = ctx.input;
3374
3419
  const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
3375
3420
  if (!owner) {
@@ -3400,7 +3445,8 @@ function createPublishGitlabAction(options) {
3400
3445
  const { id: projectId, http_url_to_repo } = await client.Projects.create({
3401
3446
  namespace_id: targetNamespace,
3402
3447
  name: repo,
3403
- visibility: repoVisibility
3448
+ visibility: repoVisibility,
3449
+ ...topics.length ? { topics } : {}
3404
3450
  });
3405
3451
  if (setUserAsOwner && integrationConfig.config.token) {
3406
3452
  const adminClient = new node.Gitlab({