diff --git a/src/handlers/pull-precheck.ts b/src/handlers/pull-precheck.ts index 6db6f24..87f2e05 100644 --- a/src/handlers/pull-precheck.ts +++ b/src/handlers/pull-precheck.ts @@ -108,8 +108,6 @@ export async function performPullPrecheck( UBIQUITY_OS_APP_NAME ); - console.log("llmResponse", llmResponse); - return handleLlmQueryOutput(context, llmResponse); } diff --git a/src/helpers/get-issue-no-from-payload.ts b/src/helpers/get-issue-no-from-payload.ts index c4f7976..006289f 100644 --- a/src/helpers/get-issue-no-from-payload.ts +++ b/src/helpers/get-issue-no-from-payload.ts @@ -3,32 +3,32 @@ import { FetchParams } from "../types/github-types"; import { logger } from "./errors"; export function getIssueNumberFromPayload(payload: Context["payload"], fetchParams?: FetchParams): number { - let issueNumber, owner, repo; + let issueNumber, owner, repo; - if (!issueNumber) { - if ("issue" in payload) { - issueNumber = payload.issue.number; - } - - if (!issueNumber && "pull_request" in payload) { - issueNumber = payload.pull_request.number; - } + if (!issueNumber) { + if ("issue" in payload) { + issueNumber = payload.issue.number; } - // takes precedence and overrides the payload - if (fetchParams) { - owner = fetchParams.owner; - repo = fetchParams.repo; - issueNumber = fetchParams.issueNum; + if (!issueNumber && "pull_request" in payload) { + issueNumber = payload.pull_request.number; } + } - if (!issueNumber) { - throw logger.error(`Error fetching issue`, { - owner: owner || payload.repository.owner.login, - repo: repo || payload.repository.name, - issue_number: issueNumber, - }); - } + // takes precedence and overrides the payload + if (fetchParams) { + owner = fetchParams.owner; + repo = fetchParams.repo; + issueNumber = fetchParams.issueNum; + } + + if (!issueNumber) { + throw logger.error(`Error fetching issue`, { + owner: owner || payload.repository.owner.login, + repo: repo || payload.repository.name, + issue_number: issueNumber, + }); + } - return issueNumber; -} \ No newline at end of file + return issueNumber; +} diff --git a/src/helpers/gql-functions.ts b/src/helpers/gql-functions.ts index d97aa98..d555412 100644 --- a/src/helpers/gql-functions.ts +++ b/src/helpers/gql-functions.ts @@ -21,7 +21,7 @@ export async function checkIfPrClosesIssues( pr_number, }); - const closingIssues = result.repository.issue.closedByPullRequestsReferences.edges.map((edge) => ({ + const closingIssues = result.repository.pullRequest.closingIssuesReferences.edges.map((edge) => ({ number: edge.node.number, title: edge.node.title, url: edge.node.url, diff --git a/src/helpers/gql-queries.ts b/src/helpers/gql-queries.ts index e87851c..c21113a 100644 --- a/src/helpers/gql-queries.ts +++ b/src/helpers/gql-queries.ts @@ -6,8 +6,8 @@ type ClosedByPullRequestsReferences = { export type IssuesClosedByThisPr = { repository: { - issue: { - closedByPullRequestsReferences: { + pullRequest: { + closingIssuesReferences: { edges: ClosedByPullRequestsReferences[]; }; };