Skip to content

Commit

Permalink
chore: fix search query and v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Aug 16, 2024
1 parent c14c338 commit 55f86c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/handlers/collect-linked-pulls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { IssuesSearch } from "../types/github-types";

export type IssueParams = ReturnType<typeof parseIssueUrl>;

// cannot use more than 5 AND / OR / NOT operators in a query
function additionalBooleanFilters(issueNumber: number) {
return `linked:${issueNumber} in:body "closes #${issueNumber}" OR "Closes #${issueNumber}" OR "fixes #${issueNumber}" OR "Fixes #${issueNumber}" OR "fix #${issueNumber}" OR "resolves #${issueNumber}" OR "Resolves #${issueNumber}"`;
return `in:body "closes #${issueNumber}" OR "fixes #${issueNumber}" OR "resolves #${issueNumber}"`;
}

export async function collectLinkedPullRequests(context: Context, issue: IssueParams) {
Expand Down
14 changes: 1 addition & 13 deletions src/helpers/update-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function updateTasks(context: Context) {
}

for (const repo of repos) {
logger.info(`Updating reminders for ${repo.owner.login}/${repo.name}`);
await updateReminders(context, repo);
}

Expand Down Expand Up @@ -71,10 +70,6 @@ async function updateReminderForIssue(context: Context, repo: ListForOrg["data"]
const taskDeadlineMatch = taskDeadlineJsonRegex.exec(botAssignmentComments[0]?.body || "");
const taskAssigneesMatch = taskAssigneesJsonRegex.exec(botAssignmentComments[0]?.body || "");

if (!taskDeadlineMatch || !taskAssigneesMatch) {
logger.error(`Missing metadata from ${issue.url}`);
}

const metadata = {
taskDeadline: taskDeadlineMatch?.[1] || "",
taskAssignees: taskAssigneesMatch?.[1]
Expand All @@ -94,7 +89,7 @@ async function updateReminderForIssue(context: Context, repo: ListForOrg["data"]
}

if (!metadata.taskDeadline) {
const taskDeadlineJsonRegex = /"duration": "([^"]*)"/g;
const taskDeadlineJsonRegex = /"duration": ([^,]*),/g;
const taskDeadlineMatch = taskDeadlineJsonRegex.exec(botAssignmentComments[0]?.body || "");
if (!taskDeadlineMatch) {
logger.error(`Missing deadline from ${issue.url}`);
Expand All @@ -119,10 +114,6 @@ async function updateReminderForIssue(context: Context, repo: ListForOrg["data"]
return false;
}

if (!metadata.taskDeadline) {
logger.info(`No deadline found for ${issue.url}`);
return false;
}
const deadline = DateTime.fromISO(metadata.taskDeadline);
const now = DateTime.now();

Expand Down Expand Up @@ -158,9 +149,6 @@ async function updateReminderForIssue(context: Context, repo: ListForOrg["data"]
}
}

async function legacyUpdateReminderForIssue(context: Context, repo: ListForOrg["data"][0], issue: ListIssueForRepo) {
}

function sortAndReturn(array: ListCommentsForIssue[], direction: "asc" | "desc") {
return array.sort((a, b) => {
if (direction === "asc") {
Expand Down

0 comments on commit 55f86c4

Please sign in to comment.