Skip to content

Commit

Permalink
fix: logging and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ishowvel committed Nov 12, 2024
1 parent 2533df1 commit 233a4d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/parser/github-comment-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] };
Expand Down Expand Up @@ -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}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/permit-generation-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 233a4d4

Please sign in to comment.