@@ -28,7 +28,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
2828 if ( nop ) {
2929 let filename = env . SETTINGS_FILE_PATH
3030 if ( ! deploymentConfig ) {
31- filename = env . DEPLOYMENT_CONFIG_FILE
31+ filename = env . DEPLOYMENT_CONFIG_FILE_PATH
3232 deploymentConfig = { }
3333 }
3434 const nopcommand = new NopCommand ( filename , repo , null , e , 'ERROR' )
@@ -53,7 +53,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
5353 if ( nop ) {
5454 let filename = env . SETTINGS_FILE_PATH
5555 if ( ! deploymentConfig ) {
56- filename = env . DEPLOYMENT_CONFIG_FILE
56+ filename = env . DEPLOYMENT_CONFIG_FILE_PATH
5757 deploymentConfig = { }
5858 }
5959 const nopcommand = new NopCommand ( filename , repo , null , e , 'ERROR' )
@@ -78,7 +78,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
7878 if ( nop ) {
7979 let filename = env . SETTINGS_FILE_PATH
8080 if ( ! deploymentConfig ) {
81- filename = env . DEPLOYMENT_CONFIG_FILE
81+ filename = env . DEPLOYMENT_CONFIG_FILE_PATH
8282 deploymentConfig = { }
8383 }
8484 const nopcommand = new NopCommand ( filename , repo , null , e , 'ERROR' )
@@ -104,7 +104,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
104104 if ( nop ) {
105105 let filename = env . SETTINGS_FILE_PATH
106106 if ( ! deploymentConfig ) {
107- filename = env . DEPLOYMENT_CONFIG_FILE
107+ filename = env . DEPLOYMENT_CONFIG_FILE_PATH
108108 deploymentConfig = { }
109109 }
110110 const nopcommand = new NopCommand ( filename , repo , null , e , 'ERROR' )
@@ -123,7 +123,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
123123 */
124124 async function loadYamlFileSystem ( ) {
125125 if ( deploymentConfig === undefined ) {
126- const deploymentConfigPath = env . DEPLOYMENT_CONFIG_FILE
126+ const deploymentConfigPath = env . DEPLOYMENT_CONFIG_FILE_PATH
127127 if ( fs . existsSync ( deploymentConfigPath ) ) {
128128 deploymentConfig = yaml . load ( fs . readFileSync ( deploymentConfigPath ) )
129129 } else {
@@ -134,7 +134,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
134134 }
135135
136136 function getAllChangedSubOrgConfigs ( payload ) {
137- const settingPattern = new Glob ( ` ${ env . CONFIG_PATH } /suborgs/*.yml` )
137+ const settingPattern = Settings . SUB_ORG_PATTERN
138138 // Changes will be an array of files that were added
139139 const added = payload . commits . map ( c => {
140140 return ( c . added . filter ( s => {
@@ -158,7 +158,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
158158 }
159159
160160 function getAllChangedRepoConfigs ( payload , owner ) {
161- const settingPattern = new Glob ( ` ${ env . CONFIG_PATH } /repos/*.yml` )
161+ const settingPattern = Settings . REPO_PATTERN
162162 // Changes will be an array of files that were added
163163 const added = payload . commits . map ( c => {
164164 return ( c . added . filter ( s => {
@@ -270,11 +270,11 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
270270 }
271271
272272 const settingsModified = payload . commits . find ( commit => {
273- return commit . added . includes ( Settings . FILE_NAME ) ||
274- commit . modified . includes ( Settings . FILE_NAME )
273+ return commit . added . includes ( Settings . FILE_PATH ) ||
274+ commit . modified . includes ( Settings . FILE_PATH )
275275 } )
276276 if ( settingsModified ) {
277- robot . log . debug ( `Changes in '${ Settings . FILE_NAME } ' detected, doing a full synch...` )
277+ robot . log . debug ( `Changes in '${ Settings . FILE_PATH } ' detected, doing a full synch...` )
278278 return syncAllSettings ( false , context )
279279 }
280280
@@ -292,7 +292,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
292292 } ) )
293293 }
294294
295- robot . log . debug ( `No changes in '${ Settings . FILE_NAME } ' detected, returning...` )
295+ robot . log . debug ( `No changes in '${ Settings . FILE_PATH } ' detected, returning...` )
296296 } )
297297
298298 robot . on ( 'create' , async context => {
@@ -597,21 +597,21 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
597597 const changes = await context . octokit . repos . compareCommitsWithBasehead ( params )
598598 const files = changes . data . files . map ( f => { return f . filename } )
599599
600- const settingsModified = files . includes ( Settings . FILE_NAME )
600+ const settingsModified = files . includes ( Settings . FILE_PATH )
601601
602602 if ( settingsModified ) {
603- robot . log . debug ( `Changes in '${ Settings . FILE_NAME } ' detected, doing a full synch...` )
603+ robot . log . debug ( `Changes in '${ Settings . FILE_PATH } ' detected, doing a full synch...` )
604604 return syncAllSettings ( true , context , context . repo ( ) , pull_request . head . ref )
605605 }
606606
607- const repoChanges = getChangedRepoConfigName ( new Glob ( ` ${ env . CONFIG_PATH } /repos/*.yml` ) , files , context . repo ( ) . owner )
607+ const repoChanges = getChangedRepoConfigName ( Settings . REPO_PATTERN , files , context . repo ( ) . owner )
608608 if ( repoChanges . length > 0 ) {
609609 return Promise . all ( repoChanges . map ( repo => {
610610 return syncSettings ( true , context , repo , pull_request . head . ref )
611611 } ) )
612612 }
613613
614- const subOrgChanges = getChangedSubOrgConfigName ( new Glob ( ` ${ env . CONFIG_PATH } /suborgs/*.yml` ) , files , context . repo ( ) . owner )
614+ const subOrgChanges = getChangedSubOrgConfigName ( Settings . SUB_ORG_PATTERN , files , context . repo ( ) . owner )
615615 if ( subOrgChanges . length ) {
616616 return Promise . all ( subOrgChanges . map ( suborg => {
617617 return syncSubOrgSettings ( true , context , suborg , context . repo ( ) , pull_request . head . ref )
0 commit comments