Skip to content

Commit

Permalink
refactor: move repo 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 e065226 commit cee6838
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 @@ -158,7 +158,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
}

function getAllChangedRepoConfigs (payload, owner) {
const settingPattern = new Glob(`${env.CONFIG_PATH}/repos/*.yml`)
const settingPattern = Settings.REPO_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 @@ -604,7 +604,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
return syncAllSettings(true, context, context.repo(), pull_request.head.ref)
}

const repoChanges = getChangedRepoConfigName(new Glob(`${env.CONFIG_PATH}/repos/*.yml`), files, context.repo().owner)
const repoChanges = getChangedRepoConfigName(Settings.REPO_PATTERN, files, context.repo().owner)
if (repoChanges.length > 0) {
return Promise.all(repoChanges.map(repo => {
return syncSettings(true, 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 @@ -901,6 +901,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.REPO_PATTERN = new Glob(`${CONFIG_PATH}/repos/*.yml`)

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

0 comments on commit cee6838

Please sign in to comment.