@@ -25,7 +25,7 @@ module.exports = class Environments extends Diffable {
2525 repo : this . repo . repo
2626 } )
2727
28- const environments_mapped = [ ]
28+ const environmentsMapped = [ ]
2929
3030 for ( const environment of environments ) {
3131 const mapped = {
@@ -60,11 +60,11 @@ module.exports = class Environments extends Diffable {
6060 id : rule . id
6161 } ) )
6262 }
63- environments_mapped . push ( mapped )
63+ environmentsMapped . push ( mapped )
6464 // console.log(mapped);
6565 }
6666
67- return environments_mapped
67+ return environmentsMapped
6868 }
6969
7070 comparator ( existing , attrs ) {
@@ -79,46 +79,46 @@ module.exports = class Environments extends Diffable {
7979 if ( ! attrs . variables ) attrs . variables = [ ]
8080 if ( ! attrs . deployment_protection_rules ) attrs . deployment_protection_rules = [ ]
8181
82- const wait_timer = existing . wait_timer !== attrs . wait_timer
83- const prevent_self_review = existing . prevent_self_review !== attrs . prevent_self_review
82+ const waitTimer = existing . wait_timer !== attrs . wait_timer
83+ const preventSelfReview = existing . prevent_self_review !== attrs . prevent_self_review
8484 const reviewers = JSON . stringify ( existing . reviewers . sort ( ( x1 , x2 ) => x1 . id - x2 . id ) ) !== JSON . stringify ( attrs . reviewers . sort ( ( x1 , x2 ) => x1 . id - x2 . id ) )
8585
86- let existing_custom_branch_policies = existing . deployment_branch_policy === null ? null : existing . deployment_branch_policy . custom_branch_policies
87- if ( typeof ( existing_custom_branch_policies ) === 'object' && existing_custom_branch_policies !== null ) {
88- existing_custom_branch_policies = existing_custom_branch_policies . sort ( )
86+ let existingCustomBranchPolicies = existing . deployment_branch_policy === null ? null : existing . deployment_branch_policy . custom_branch_policies
87+ if ( typeof ( existingCustomBranchPolicies ) === 'object' && existingCustomBranchPolicies !== null ) {
88+ existingCustomBranchPolicies = existingCustomBranchPolicies . sort ( )
8989 }
90- let attrs_custom_branch_policies = attrs . deployment_branch_policy === null ? null : attrs . deployment_branch_policy . custom_branch_policies
91- if ( typeof ( attrs_custom_branch_policies ) === 'object' && attrs_custom_branch_policies !== null ) {
92- attrs_custom_branch_policies = attrs_custom_branch_policies . sort ( )
90+ let attrsCustomBranchPolicies = attrs . deployment_branch_policy === null ? null : attrs . deployment_branch_policy . custom_branch_policies
91+ if ( typeof ( attrsCustomBranchPolicies ) === 'object' && attrsCustomBranchPolicies !== null ) {
92+ attrsCustomBranchPolicies = attrsCustomBranchPolicies . sort ( )
9393 }
94- let deployment_branch_policy
94+ let deploymentBranchPolicy
9595 if ( existing . deployment_branch_policy === attrs . deployment_branch_policy ) {
96- deployment_branch_policy = false
96+ deploymentBranchPolicy = false
9797 } else {
98- deployment_branch_policy = (
98+ deploymentBranchPolicy = (
9999 ( existing . deployment_branch_policy === null && attrs . deployment_branch_policy !== null ) ||
100100 ( existing . deployment_branch_policy !== null && attrs . deployment_branch_policy === null ) ||
101101 ( existing . deployment_branch_policy . protected_branches !== attrs . deployment_branch_policy . protected_branches ) ||
102- ( JSON . stringify ( existing_custom_branch_policies ) !== JSON . stringify ( attrs_custom_branch_policies ) )
102+ ( JSON . stringify ( existingCustomBranchPolicies ) !== JSON . stringify ( attrsCustomBranchPolicies ) )
103103 )
104104 }
105105
106106 const variables = JSON . stringify ( existing . variables . sort ( ( x1 , x2 ) => x1 . name - x2 . name ) ) !== JSON . stringify ( attrs . variables . sort ( ( x1 , x2 ) => x1 . name - x2 . name ) )
107- const deployment_protection_rules = JSON . stringify ( existing . deployment_protection_rules . map ( x => ( { app_id : x . app_id } ) ) . sort ( ( x1 , x2 ) => x1 . app_id - x2 . app_id ) ) !== JSON . stringify ( attrs . deployment_protection_rules . map ( x => ( { app_id : x . app_id } ) ) . sort ( ( x1 , x2 ) => x1 . app_id - x2 . app_id ) )
107+ const deploymentProtectionRules = JSON . stringify ( existing . deployment_protection_rules . map ( x => ( { app_id : x . app_id } ) ) . sort ( ( x1 , x2 ) => x1 . app_id - x2 . app_id ) ) !== JSON . stringify ( attrs . deployment_protection_rules . map ( x => ( { app_id : x . app_id } ) ) . sort ( ( x1 , x2 ) => x1 . app_id - x2 . app_id ) )
108108
109- return { wait_timer , prevent_self_review , reviewers, deployment_branch_policy , variables, deployment_protection_rules }
109+ return { waitTimer , preventSelfReview , reviewers, deploymentBranchPolicy , variables, deploymentProtectionRules }
110110 }
111111
112112 changed ( existing , attrs ) {
113- const { wait_timer , prevent_self_review , reviewers, deployment_branch_policy , variables, deployment_protection_rules } = this . getChanged ( existing , attrs )
113+ const { waitTimer , preventSelfReview , reviewers, deploymentBranchPolicy , variables, deploymentProtectionRules } = this . getChanged ( existing , attrs )
114114
115- return wait_timer || prevent_self_review || reviewers || deployment_branch_policy || variables || deployment_protection_rules
115+ return waitTimer || preventSelfReview || reviewers || deploymentBranchPolicy || variables || deploymentProtectionRules
116116 }
117117
118118 async update ( existing , attrs ) {
119- const { wait_timer , prevent_self_review , reviewers, deployment_branch_policy , variables, deployment_protection_rules } = this . getChanged ( existing , attrs )
119+ const { waitTimer , preventSelfReview , reviewers, deploymentBranchPolicy , variables, deploymentProtectionRules } = this . getChanged ( existing , attrs )
120120
121- if ( wait_timer || prevent_self_review || reviewers || deployment_branch_policy ) {
121+ if ( waitTimer || preventSelfReview || reviewers || deploymentBranchPolicy ) {
122122 await this . github . request ( 'PUT /repos/:org/:repo/environments/:environment_name' , {
123123 org : this . repo . owner ,
124124 repo : this . repo . repo ,
@@ -135,7 +135,7 @@ module.exports = class Environments extends Diffable {
135135 } )
136136 }
137137
138- if ( deployment_branch_policy && attrs . deployment_branch_policy && attrs . deployment_branch_policy . custom_branch_policies ) {
138+ if ( deploymentBranchPolicy && attrs . deployment_branch_policy && attrs . deployment_branch_policy . custom_branch_policies ) {
139139 const existingPolicies = ( await this . github . request ( 'GET /repos/:org/:repo/environments/:environment_name/deployment-branch-policies' , {
140140 org : this . repo . owner ,
141141 repo : this . repo . repo ,
@@ -198,7 +198,7 @@ module.exports = class Environments extends Diffable {
198198 }
199199 }
200200
201- if ( deployment_protection_rules ) {
201+ if ( deploymentProtectionRules ) {
202202 const existingRules = [ ...existing . deployment_protection_rules ]
203203
204204 for ( const rule of attrs . deployment_protection_rules ) {
0 commit comments