Skip to content

Commit

Permalink
chore: test logger
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 2, 2025
1 parent 630c2f7 commit 3ce6b15
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@octokit/types": "^13.6.2",
"@sinclair/typebox": "0.34.3",
"@supabase/supabase-js": "2.42.0",
"@ubiquity-os/plugin-sdk": "^1.1.1",
"@ubq-mentlegen/plugin-sdk": "^1.0.9",
"@ubiquity-os/ubiquity-os-logger": "^1.3.2",
"dotenv": "^16.4.7",
"hono": "^4.6.14",
Expand Down
29 changes: 16 additions & 13 deletions src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { postComment } from "../../../../plugin-sdk";
import { AssignedIssue, Context, ISSUE_TYPE, Label } from "../../types";
import { isUserCollaborator } from "../../utils/get-user-association";
import { addAssignees, addCommentToIssue, getAssignedIssues, getPendingOpenedPullRequests, getTimeValue, isParentIssue } from "../../utils/issue";
Expand All @@ -6,7 +7,6 @@ import { hasUserBeenUnassigned } from "./check-assignments";
import { checkTaskStale } from "./check-task-stale";
import { generateAssignmentComment } from "./generate-assignment-comment";
import { getUserRoleAndTaskLimit } from "./get-user-task-limit-and-role";
import structuredMetadata from "./structured-metadata";
import { assignTableComment } from "./table";

async function checkRequirements(context: Context, issue: Context<"issue_comment.created">["payload"]["issue"], login: string) {
Expand Down Expand Up @@ -176,25 +176,28 @@ ${issues}
priceLabel,
revision: commitHash?.substring(0, 7),
});
const metadata = structuredMetadata.create("Assignment", logMessage);
// const metadata = structuredMetadata.create("Assignment", logMessage);

// add assignee
await addAssignees(context, issue.number, toAssign);

const isTaskStale = checkTaskStale(getTimeValue(taskStaleTimeoutDuration), issue.created_at);

await addCommentToIssue(
await postComment(
context,
[
assignTableComment({
isTaskStale,
daysElapsedSinceTaskCreation: assignmentComment.daysElapsedSinceTaskCreation,
taskDeadline: assignmentComment.deadline,
registeredWallet: assignmentComment.registeredWallet,
}),
assignmentComment.tips,
metadata,
].join("\n") as string
context.logger.info(
[
assignTableComment({
isTaskStale,
daysElapsedSinceTaskCreation: assignmentComment.daysElapsedSinceTaskCreation,
taskDeadline: assignmentComment.deadline,
registeredWallet: assignmentComment.registeredWallet,
}),
assignmentComment.tips,
].join("\n") as string,
logMessage.metadata
),
true
);

return { content: "Task assigned successfully", status: HttpStatusCode.OK };
Expand Down

0 comments on commit 3ce6b15

Please sign in to comment.