chore: more logging
Node.js CI / Lint and Test (push) Successful in 47s

This commit is contained in:
2025-08-27 18:07:37 -07:00
parent 1b7f83f335
commit 8275b36287
+7
View File
@@ -4,6 +4,7 @@
* @author Naomi Carrigan * @author Naomi Carrigan
*/ */
import { logger } from "../utils/logger.js";
import type { Amari } from "../interfaces/amari.js"; import type { Amari } from "../interfaces/amari.js";
import type { IssueCreated, import type { IssueCreated,
PullRequestCreated, PullRequestCreated,
@@ -24,6 +25,7 @@ const isPull = (body: GithubPayload): body is PullRequestCreated => {
* @param request - The Fastify request payload. * @param request - The Fastify request payload.
* @param response - The Fastify reply class. * @param response - The Fastify reply class.
*/ */
// eslint-disable-next-line max-statements -- STFU.
export const processGithubEvent = async( export const processGithubEvent = async(
amari: Amari, amari: Amari,
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard. // eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard.
@@ -43,6 +45,7 @@ export const processGithubEvent = async(
const { action } = request.body; const { action } = request.body;
await response.status(200).send({ message: "Payload received!" }); await response.status(200).send({ message: "Payload received!" });
if (action === "opened" && event === "issue" && isIssue(request.body)) { if (action === "opened" && event === "issue" && isIssue(request.body)) {
await logger.log("info", "Processing new issue");
const { issue, repository } = request.body; const { issue, repository } = request.body;
const { number } = issue; const { number } = issue;
const { owner, name } = repository; const { owner, name } = repository;
@@ -53,8 +56,10 @@ export const processGithubEvent = async(
owner: owner.login, owner: owner.login,
repo: name, repo: name,
}); });
return;
} }
if (action === "opened" && event === "pull_request" && isPull(request.body)) { if (action === "opened" && event === "pull_request" && isPull(request.body)) {
await logger.log("info", "Processing new PR");
const { pull_request: pr, repository } = request.body; const { pull_request: pr, repository } = request.body;
const { number } = pr; const { number } = pr;
const { owner, name } = repository; const { owner, name } = repository;
@@ -65,5 +70,7 @@ export const processGithubEvent = async(
repo: name, repo: name,
reviewers: [ "naomi-lgbt" ], reviewers: [ "naomi-lgbt" ],
}); });
return;
} }
await logger.log("warn", `Received ${event} ${String(action)} payload and do not know how to process.`);
}; };