Skip to content

Commit

Permalink
refactor: move sub-org config pattern to Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
PendaGTP committed Jan 10, 2025
1 parent 7fdc33e commit e065226
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
}

function getAllChangedSubOrgConfigs (payload) {
const settingPattern = new Glob(`${env.CONFIG_PATH}/suborgs/*.yml`)
const settingPattern = Settings.SUB_ORG_PATTERN
// Changes will be an array of files that were added
const added = payload.commits.map(c => {
return (c.added.filter(s => {
Expand Down Expand Up @@ -611,7 +611,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
}))
}

const subOrgChanges = getChangedSubOrgConfigName(new Glob(`${env.CONFIG_PATH}/suborgs/*.yml`), files, context.repo().owner)
const subOrgChanges = getChangedSubOrgConfigName(Settings.SUB_ORG_PATTERN, files, context.repo().owner)
if (subOrgChanges.length) {
return Promise.all(subOrgChanges.map(suborg => {
return syncSubOrgSettings(true, context, suborg, context.repo(), pull_request.head.ref)
Expand Down
1 change: 1 addition & 0 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ function prettify (obj) {
}

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

Settings.PLUGINS = {
repository: require('./plugins/repository'),
Expand Down

0 comments on commit e065226

Please sign in to comment.