Skip to content

Commit e065226

Browse files
committed
refactor: move sub-org config pattern to Settings
1 parent 7fdc33e commit e065226

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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 => {
@@ -611,7 +611,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
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)

lib/settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ function prettify (obj) {
900900
}
901901

902902
Settings.FILE_PATH = path.posix.join(CONFIG_PATH, env.SETTINGS_FILE_PATH)
903+
Settings.SUB_ORG_PATTERN = new Glob(`${CONFIG_PATH}/suborgs/*.yml`)
903904

904905
Settings.PLUGINS = {
905906
repository: require('./plugins/repository'),

0 commit comments

Comments
 (0)