Skip to content

Commit cee6838

Browse files
committed
refactor: move repo config pattern to Settings
1 parent e065226 commit cee6838

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
@@ -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 => {
@@ -604,7 +604,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
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)

lib/settings.js

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

902902
Settings.FILE_PATH = path.posix.join(CONFIG_PATH, env.SETTINGS_FILE_PATH)
903903
Settings.SUB_ORG_PATTERN = new Glob(`${CONFIG_PATH}/suborgs/*.yml`)
904+
Settings.REPO_PATTERN = new Glob(`${CONFIG_PATH}/repos/*.yml`)
904905

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

0 commit comments

Comments
 (0)