diff --git a/src/modules/processGitHubEvent.ts b/src/modules/processGitHubEvent.ts index 2558510..2db66a6 100644 --- a/src/modules/processGitHubEvent.ts +++ b/src/modules/processGitHubEvent.ts @@ -4,6 +4,7 @@ * @author Naomi Carrigan */ +import { logger } from "../utils/logger.js"; import type { Amari } from "../interfaces/amari.js"; import type { IssueCreated, PullRequestCreated, @@ -24,6 +25,7 @@ const isPull = (body: GithubPayload): body is PullRequestCreated => { * @param request - The Fastify request payload. * @param response - The Fastify reply class. */ +// eslint-disable-next-line max-statements -- STFU. export const processGithubEvent = async( amari: Amari, // eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard. @@ -43,6 +45,7 @@ export const processGithubEvent = async( const { action } = request.body; await response.status(200).send({ message: "Payload received!" }); if (action === "opened" && event === "issue" && isIssue(request.body)) { + await logger.log("info", "Processing new issue"); const { issue, repository } = request.body; const { number } = issue; const { owner, name } = repository; @@ -53,8 +56,10 @@ export const processGithubEvent = async( owner: owner.login, repo: name, }); + return; } if (action === "opened" && event === "pull_request" && isPull(request.body)) { + await logger.log("info", "Processing new PR"); const { pull_request: pr, repository } = request.body; const { number } = pr; const { owner, name } = repository; @@ -65,5 +70,7 @@ export const processGithubEvent = async( repo: name, reviewers: [ "naomi-lgbt" ], }); + return; } + await logger.log("warn", `Received ${event} ${String(action)} payload and do not know how to process.`); };