Skip to content

Commit 6b358e5

Browse files
committed
depup files in a push
1 parent b87397c commit 6b358e5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,19 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
263263
return syncAllSettings(false, context)
264264
}
265265

266-
const repoChanges = getAllChangedRepoConfigs(payload, context.repo().owner)
266+
let repoChanges = getAllChangedRepoConfigs(payload, context.repo().owner)
267267

268-
const subOrgChanges = getAllChangedSubOrgConfigs(payload)
268+
let subOrgChanges = getAllChangedSubOrgConfigs(payload)
269+
const dedupedRepos = [...new Set(repoChanges.map(r => r.repo))].map(name => {
270+
return repoChanges.find(r => r.repo === name)
271+
})
272+
repoChanges = dedupedRepos
273+
const dedupedSubOrgs = [...new Set(subOrgChanges.map(s => s.name))].map(name => {
274+
return subOrgChanges.find(s => s.name === name)
275+
})
276+
subOrgChanges = dedupedSubOrgs
277+
robot.log.debug(`deduped repos ${JSON.stringify(repoChanges)}`)
278+
robot.log.debug(`deduped subOrgs ${JSON.stringify(subOrgChanges)}`)
269279

270280
if (repoChanges.length > 0 || subOrgChanges.length > 0) {
271281
return syncSelectedSettings(false, context, repoChanges, subOrgChanges)

0 commit comments

Comments
 (0)