Skip to content

Commit

Permalink
chore: eslint, remove console.log, type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Oct 24, 2024
1 parent 638acbf commit 00534fa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 28 deletions.
2 changes: 0 additions & 2 deletions src/handlers/pull-precheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ export async function performPullPrecheck(
UBIQUITY_OS_APP_NAME
);

console.log("llmResponse", llmResponse);

return handleLlmQueryOutput(context, llmResponse);
}

Expand Down
46 changes: 23 additions & 23 deletions src/helpers/get-issue-no-from-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
return issueNumber;
}
2 changes: 1 addition & 1 deletion src/helpers/gql-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/gql-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ type ClosedByPullRequestsReferences = {

export type IssuesClosedByThisPr = {
repository: {
issue: {
closedByPullRequestsReferences: {
pullRequest: {
closingIssuesReferences: {
edges: ClosedByPullRequestsReferences[];
};
};
Expand Down

0 comments on commit 00534fa

Please sign in to comment.