Skip to content

Commit 2dc68b5

Browse files
committed
- added sync calling instantly
1 parent 4ede8e5 commit 2dc68b5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const getStalePulls = async (app, context, owner) => {
9191
app.log.info(`Checking repos for stale rule: X < ${filterDate.toISOString()}`);
9292
app.log.info(repos);
9393
return repos.reduce(async (acc, repo) => {
94+
const previous = await acc;
9495
const { data: foundPulls } = await context.octokit.pulls.list({
9596
owner,
9697
repo,
@@ -99,13 +100,13 @@ const getStalePulls = async (app, context, owner) => {
99100
direction: 'asc',
100101
});
101102
app.log.info(`Found ${foundPulls.length} pulls for repo ${repo}`);
102-
acc.push(
103+
return [
104+
...previous,
103105
...foundPulls
104106
.filter((p) => new Date(p.updated_at) < filterDate)
105-
.map((p) => ({ pullNumber: p.number, owner, repo }))
106-
);
107-
return acc;
108-
}, []);
107+
.map((p) => ({ pullNumber: p.number, owner, repo })),
108+
];
109+
}, Promise.resolve([]));
109110
}
110111

111112
const updatePulls = async (app, context, owner) => {

0 commit comments

Comments
 (0)