Skip to content

Commit 8bc76fc

Browse files
decyjphrCopilot
andauthored
Update index.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ac8e195 commit 8bc76fc

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,9 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) =>
266266
let repoChanges = getAllChangedRepoConfigs(payload, context.repo().owner)
267267

268268
let subOrgChanges = getAllChangedSubOrgConfigs(payload)
269-
const dedupedRepos = [...new Set(repoChanges.map(r => r.repo))].map(repo => {
270-
return repoChanges.find(r => r.repo === repo)
271-
})
272-
repoChanges = dedupedRepos
273-
const dedupedSubOrgs = [...new Set(subOrgChanges.map(s => s.repo))].map(repo => {
274-
return subOrgChanges.find(s => s.repo === repo)
275-
})
276-
subOrgChanges = dedupedSubOrgs
269+
repoChanges = repoChanges.filter((r, i, arr) => arr.findIndex(item => item.repo === r.repo) === i)
270+
271+
subOrgChanges = subOrgChanges.filter((s, i, arr) => arr.findIndex(item => item.repo === s.repo) === i)
277272
robot.log.debug(`deduped repos ${JSON.stringify(repoChanges)}`)
278273
robot.log.debug(`deduped subOrgs ${JSON.stringify(subOrgChanges)}`)
279274

0 commit comments

Comments
 (0)