diff options
author | Ivan Blinkov <ivan@ydb.tech> | 2025-04-23 22:39:34 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-23 22:39:34 +0700 |
commit | 5406f56a6ec4c1d247da80f924589d36c56c81ee (patch) | |
tree | b0ce19c18fd131ebdbc161305b98cbeb1e67ed1d | |
parent | 9583eeefa8c174e3861b31fed8299b665a6868ef (diff) | |
download | ydb-5406f56a6ec4c1d247da80f924589d36c56c81ee.tar.gz |
[ci] fix for docs_pr_nudge.yaml (#17635)
-rw-r--r-- | .github/workflows/docs_pr_nudge.yaml | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/.github/workflows/docs_pr_nudge.yaml b/.github/workflows/docs_pr_nudge.yaml index d00a1cb0327..233974ba0fb 100644 --- a/.github/workflows/docs_pr_nudge.yaml +++ b/.github/workflows/docs_pr_nudge.yaml @@ -116,16 +116,20 @@ jobs: const [comments, reviewComments, reviews, commits] = await Promise.all([ github.paginate(github.rest.issues.listComments, { owner, repo, issue_number: prNum, per_page: 100 }), github.paginate(github.rest.pulls.listReviewComments, { owner, repo, pull_number: prNum, per_page: 100 }), - github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number: prNum, per_page: 100 }), - github.paginate(github.rest.pulls.listCommits, { owner, repo, pull_number: prNum, per_page: 100 }), + github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number: prNum, per_page: 100 }), + github.paginate(github.rest.pulls.listCommits, { owner, repo, pull_number: prNum, per_page: 100 }), ]); const author = pr.user.login; const assignees = pr.assignees.map(a => a.login); const extract = (arr, whoFn, dateKey) => - arr.map(i => ({ who: whoFn(i), when: new Date(i[dateKey]) })) - .filter(x => x.when); + arr + .map(i => { + const d = new Date(i[dateKey]); + return { who: whoFn(i), when: d }; + }) + .filter(x => x.when && !isNaN(x.when.getTime())); const allEvents = [ ...extract(comments, c => c.user.login, 'created_at'), @@ -133,7 +137,7 @@ jobs: ...extract(reviews, r => r.user.login, 'submitted_at'), ...extract(commits, c => c.author?.login || c.commit?.author?.name, 'commit.author.date'), { who: author, when: new Date(pr.created_at) } - ]; + ].filter(e => e.when && !isNaN(e.when.getTime())); const authorEvents = allEvents.filter(e => e.who === author).map(e => e.when); const reviewerEvents = allEvents.filter(e => assignees.includes(e.who)).map(e => e.when); @@ -142,8 +146,9 @@ jobs: const lastReviewerActivity = reviewerEvents.length ? new Date(Math.max(...reviewerEvents)) : new Date(0); // last nudge time - const nudgeTimes = comments.filter(c => c.body.includes(BOT_MARKER)) - .map(c => new Date(c.created_at)); + const nudgeTimes = comments + .map(c => new Date(c.created_at)) + .filter(d => !isNaN(d.getTime()) && comments.find(cc => cc.body.includes(BOT_MARKER))); const lastNudgeTime = nudgeTimes.length ? new Date(Math.max(...nudgeTimes)) : new Date(0); // RULE 1: nudge reviewers |