From 233a4d4081739dca66f4fdd9ca466e27c992fe73 Mon Sep 17 00:00:00 2001 From: ishowvel Date: Tue, 12 Nov 2024 06:57:03 +0000 Subject: [PATCH] fix: logging and comments --- src/parser/github-comment-module.ts | 12 +++++++----- src/parser/permit-generation-module.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/parser/github-comment-module.ts b/src/parser/github-comment-module.ts index e927fa79..daf0ee0f 100644 --- a/src/parser/github-comment-module.ts +++ b/src/parser/github-comment-module.ts @@ -13,6 +13,7 @@ import { getErc20TokenSymbol } from "../helpers/web3"; import { IssueActivity } from "../issue-activity"; import { BaseModule } from "../types/module"; import { GithubCommentScore, Result } from "../types/results"; +import { postComment } from "@ubiquity-os/plugin-sdk"; interface SortedTasks { issues: { specification: GithubCommentScore | null; comments: GithubCommentScore[] }; @@ -110,11 +111,12 @@ export class GithubCommentModule extends BaseModule { } if (this._configuration?.post) { try { - await this.postComment( - Object.values(result).some((v) => v.permitUrl) - ? body - : "Skipping generating permits due to issue being non collaborative" - ); + if (Object.values(result).some((v) => v.permitUrl)) { + await this.postComment(body); + } else { + const errorLog = this.context.logger.error("Issue is non collaborative. Skipping permit generation."); + await postComment(this.context, errorLog); + } } catch (e) { this.context.logger.error(`Could not post GitHub comment: ${e}`); } diff --git a/src/parser/permit-generation-module.ts b/src/parser/permit-generation-module.ts index 119376e1..da9f8129 100644 --- a/src/parser/permit-generation-module.ts +++ b/src/parser/permit-generation-module.ts @@ -45,7 +45,7 @@ export class PermitGenerationModule extends BaseModule { ); if (!canGeneratePermits) { - console.warn("[PermitGenerationModule] Non collaborative issue detected, skipping."); + this.context.logger.error("[PermitGenerationModule] Non collaborative issue detected, skipping."); return Promise.resolve(result); } const payload: Context["payload"] & Payload = {