ref(plugins): centralize skip and ignore filters (#1238)

This commit is contained in:
Simon Lecoq
2022-09-21 23:50:18 -04:00
committed by GitHub
parent b0244de50e
commit 8523db79cb
13 changed files with 106 additions and 71 deletions

View File

@@ -35,7 +35,7 @@ export default async function({login, q, imports, data, rest, account}, {enabled
: await rest.activity.listEventsForAuthenticatedUser({username: login, per_page: 100, page})).data
.filter(({type}) => type === "PushEvent")
.filter(({actor}) => account === "organization" ? true : actor.login?.toLocaleLowerCase() === login.toLocaleLowerCase())
.filter(({repo: {name: repo}}) => !((skipped.includes(repo.split("/").pop())) || (skipped.includes(repo))))
.filter(({repo: {name: repo}}) => imports.filters.repo(repo, skipped))
.filter(event => visibility === "public" ? event.public : true)
.filter(({created_at}) => Number.isFinite(days) ? new Date(created_at) > new Date(Date.now() - days * 24 * 60 * 60 * 1000) : true)
.flatMap(({created_at: created, payload}) => Promise.all(payload.commits.map(async commit => ({created: new Date(created), ...(await rest.request(commit.url)).data})))),