From 4d09c74587c9a1fe097295b7ebdf8ca422b32fad Mon Sep 17 00:00:00 2001 From: EtherealGlow Date: Sat, 21 Oct 2023 11:29:41 +0000 Subject: [PATCH] feat: add reviewer follow up --- src/handlers/wildcard/unassign.ts | 1 + src/helpers/issue.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/handlers/wildcard/unassign.ts b/src/handlers/wildcard/unassign.ts index dceabef16..f435b25ae 100644 --- a/src/handlers/wildcard/unassign.ts +++ b/src/handlers/wildcard/unassign.ts @@ -73,6 +73,7 @@ const checkBountyToUnassign = async (issue: Issue): Promise => { msg += "@" + reviewer.login + " "; } } + if (!msg.includes("@")) return false; msg += "Can you please review this pull request"; // the below function can also add comment to prs await addCommentToIssue(msg, pullRequest[0].number); diff --git a/src/helpers/issue.ts b/src/helpers/issue.ts index 2c2739238..953519f75 100644 --- a/src/helpers/issue.ts +++ b/src/helpers/issue.ts @@ -18,7 +18,7 @@ export const getAllIssueEvents = async () => { // Fetch issue events const response = await context.octokit.issues.listEvents({ owner: payload.repository.owner.login, - repo: payload.repository.full_name, + repo: payload.repository.name, issue_number: payload.issue.number, per_page: 100, page: page_number, @@ -658,7 +658,7 @@ export const getPullByNumber = async (context: Context, pull_number: number) => } }; -export async function getRequestedReviewerStart (user: string) { +export async function getRequestedReviewerStart(user: string) { let events = await getAllIssueEvents(); if (!events) return null; const filteredEvents = events.filter((e) => e.event === "review_requested" && e.requested_reviewer?.login === user); @@ -667,7 +667,7 @@ export async function getRequestedReviewerStart (user: string) { } else { return events[events.length - 1].created_at; } -}; +} // Get issues assigned to a username export const getAssignedIssues = async (username: string) => { const issuesArr = [];