@@ -116,24 +116,28 @@ jobs:
116
116
const [comments, reviewComments, reviews, commits] = await Promise.all([
117
117
github.paginate(github.rest.issues.listComments, { owner, repo, issue_number : prNum, per_page: 100 }),
118
118
github.paginate(github.rest.pulls.listReviewComments, { owner, repo, pull_number : prNum, per_page: 100 }),
119
- github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number : prNum, per_page: 100 }),
120
- github.paginate(github.rest.pulls.listCommits, { owner, repo, pull_number : prNum, per_page: 100 }),
119
+ github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number : prNum, per_page: 100 }),
120
+ github.paginate(github.rest.pulls.listCommits, { owner, repo, pull_number : prNum, per_page: 100 }),
121
121
]);
122
122
123
123
const author = pr.user.login;
124
124
const assignees = pr.assignees.map(a => a.login);
125
125
126
126
const extract = (arr, whoFn, dateKey) =>
127
- arr.map(i => ({ who : whoFn(i), when: new Date(i[dateKey]) }))
128
- .filter(x => x.when);
127
+ arr
128
+ .map(i => {
129
+ const d = new Date(i[dateKey]);
130
+ return { who : whoFn(i), when: d };
131
+ })
132
+ .filter(x => x.when && !isNaN(x.when.getTime()));
129
133
130
134
const allEvents = [
131
135
...extract(comments, c => c.user.login, 'created_at'),
132
136
...extract(reviewComments, c => c.user.login, 'created_at'),
133
137
...extract(reviews, r => r.user.login, 'submitted_at'),
134
138
...extract(commits, c => c.author?.login || c.commit?.author?.name, 'commit.author.date'),
135
139
{ who: author, when: new Date(pr.created_at) }
136
- ];
140
+ ].filter(e => e.when && !isNaN(e.when.getTime())) ;
137
141
138
142
const authorEvents = allEvents.filter(e => e.who === author).map(e => e.when);
139
143
const reviewerEvents = allEvents.filter(e => assignees.includes(e.who)).map(e => e.when);
@@ -142,8 +146,9 @@ jobs:
142
146
const lastReviewerActivity = reviewerEvents.length ? new Date(Math.max(...reviewerEvents)) : new Date(0);
143
147
144
148
// last nudge time
145
- const nudgeTimes = comments.filter(c => c.body.includes(BOT_MARKER))
146
- .map(c => new Date(c.created_at));
149
+ const nudgeTimes = comments
150
+ .map(c => new Date(c.created_at))
151
+ .filter(d => !isNaN(d.getTime()) && comments.find(cc => cc.body.includes(BOT_MARKER)));
147
152
const lastNudgeTime = nudgeTimes.length ? new Date(Math.max(...nudgeTimes)) : new Date(0);
148
153
149
154
// RULE 1 : nudge reviewers
0 commit comments