feat: process 2 pages of events

This commit is contained in:
2018-10-18 16:30:21 -07:00
parent d1cfd7c20b
commit c117cb847d

View File

@@ -1,7 +1,17 @@
export default async function getEvents(repo, { body, actor } = {}) { export default async function getEvents(repo, { body, actor } = {}) {
const { items: events } = await repo.events.fetch(); const events = await repo.events.fetch();
return events const items = await (async () => {
// process 2 pages of events
if (events.nextPage) {
const moreEvents = await events.nextPage.fetch();
return [...events.items, ...moreEvents.items];
}
return events.items;
})();
return items
.map(comment => { .map(comment => {
// only comments created by specific user // only comments created by specific user
if (comment.type !== 'IssueCommentEvent') return false; if (comment.type !== 'IssueCommentEvent') return false;