Skip to content

Commit

Permalink
non-pr-event
Browse files Browse the repository at this point in the history
  • Loading branch information
sibljon committed Sep 11, 2024
1 parent 5134fac commit 6686519
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export async function run(): Promise<void> {
? github.context.payload.pull_request?.body
: github.context.payload.commits?.[0]?.message;
if (!body) {
core.info(`ℹ️ github.context: ${JSON.stringify(github.context)}`);
core.info(`🛑 couldn't find PR body`);
return;
}
Expand Down Expand Up @@ -147,16 +148,13 @@ export async function run(): Promise<void> {
});
const reviews = reviewsData.data;

const latestReviews = (reviews ?? []).reduce(
(acc, review) => {
if (!review.user) {
return acc;
}
acc[review.user.login] = review;
const latestReviews = (reviews ?? []).reduce((acc, review) => {
if (!review.user) {
return acc;
},
{} as Record<string, (typeof reviews)[number]>
);
}
acc[review.user.login] = review;
return acc;
}, {} as Record<string, typeof reviews[number]>);

const latestReviewsArray = Object.values(latestReviews || {});
core.info(`🔍 latestReviewsArray: ${JSON.stringify(latestReviewsArray)}`);
Expand Down

0 comments on commit 6686519

Please sign in to comment.