@repository-settings/app 3.0.9 → 3.1.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.
@@ -38,7 +38,9 @@ function deploymentBranchPolicyToString (attrs) {
38
38
  return JSON.stringify(
39
39
  shouldUseProtectedBranches(attrs.protected_branches, attrs.custom_branches)
40
40
  ? { protected_branches: true }
41
- : { custom_branches: attrs.custom_branches.sort() }
41
+ : {
42
+ custom_branches: attrs.custom_branches.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))
43
+ }
42
44
  )
43
45
  }
44
46
  }
@@ -66,6 +68,14 @@ module.exports = class Environments extends Diffable {
66
68
  // Force all names to lowercase to avoid comparison issues.
67
69
  this.entries.forEach(environment => {
68
70
  environment.name = environment.name.toLowerCase()
71
+ if (environment.deployment_branch_policy && environment.deployment_branch_policy.custom_branches) {
72
+ environment.deployment_branch_policy.custom_branches = environment.deployment_branch_policy.custom_branches.map(
73
+ rule => ({
74
+ name: rule.name || rule,
75
+ type: rule.type || 'branch'
76
+ })
77
+ )
78
+ }
69
79
  })
70
80
  }
71
81
  }
@@ -88,7 +98,10 @@ module.exports = class Environments extends Diffable {
88
98
  environment.name
89
99
  )
90
100
  environment.deployment_branch_policy = {
91
- custom_branches: branchPolicies.map(_ => _.name)
101
+ custom_branches: branchPolicies.map(_ => ({
102
+ name: _.name,
103
+ type: _.type
104
+ }))
92
105
  }
93
106
  } else {
94
107
  environment.deployment_branch_policy = {
@@ -147,12 +160,13 @@ module.exports = class Environments extends Diffable {
147
160
 
148
161
  if (attrs.deployment_branch_policy && attrs.deployment_branch_policy.custom_branches) {
149
162
  await Promise.all(
150
- attrs.deployment_branch_policy.custom_branches.map(name =>
163
+ attrs.deployment_branch_policy.custom_branches.map(rule =>
151
164
  this.github.request('POST /repos/:org/:repo/environments/:environment_name/deployment-branch-policies', {
152
165
  org: this.repo.owner,
153
166
  repo: this.repo.repo,
154
167
  environment_name: attrs.name,
155
- name
168
+ name: rule.name,
169
+ type: rule.type
156
170
  })
157
171
  )
158
172
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repository-settings/app",
3
- "version": "3.0.9",
3
+ "version": "3.1.0",
4
4
  "description": "Pull Requests for GitHub repository settings",
5
5
  "repository": "github:repository-settings/app",
6
6
  "main": "index.js",
@@ -38,10 +38,10 @@
38
38
  "http-status-codes": "2.3.0",
39
39
  "jest": "29.7.0",
40
40
  "jest-when": "3.6.0",
41
- "lockfile-lint": "4.13.2",
42
- "ls-engines": "0.9.1",
41
+ "lockfile-lint": "4.14.0",
42
+ "ls-engines": "0.9.2",
43
43
  "msw": "2.3.1",
44
- "nodemon": "3.1.3",
44
+ "nodemon": "3.1.4",
45
45
  "npm-run-all2": "6.2.0",
46
46
  "prettier-standard": "16.4.1",
47
47
  "publint": "0.2.8",