Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

fix: remove totals from metadata #23

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist
.env
.env
.DS_Store
src/*.html
4 changes: 2 additions & 2 deletions src/handlers/issue/generate-permits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export async function generatePermits(
supabase: SupabaseClient
) {
const { html: comment, allTxs } = await generateComment(totals, issue, config, supabase);
console.trace({ totals });
const metadata = structuredMetadata.create("Transactions", { allTxs, totals });

const metadata = structuredMetadata.create("Transactions", allTxs);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed here

return comment.concat("\n", metadata);
}

Expand Down
34 changes: 25 additions & 9 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ afterEach(() => {
const inputs: DelegatedComputeInputs = {
eventName: "issues.closed" as GitHubEvent.ISSUES_CLOSED,
issueOwner: "ubiquibot",
issueRepository: "production",
issueNumber: "84",
issueRepository: "comment-incentives",
issueNumber: "19",
collaborators: `["pavlovcik"]`,
installationId: "37627918", // "ubiquibot-dev" app
};
Expand All @@ -19,8 +19,8 @@ jest.mock("@actions/github", () => {
const inputs: DelegatedComputeInputs = {
eventName: "issues.closed" as GitHubEvent.ISSUES_CLOSED,
issueOwner: "ubiquibot",
issueRepository: "production",
issueNumber: "84",
issueRepository: "comment-incentives",
issueNumber: "19",
collaborators: `["pavlovcik"]`,
installationId: "37627918", // "ubiquibot-dev" app
};
Expand All @@ -34,15 +34,31 @@ jest.mock("@actions/github", () => {
};
});

import fs from "fs";
import path from "path";
export async function indexTest() {
const authenticatedOctokit = await getAuthenticatedOctokit();
const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY);

const output = await issueClosedEventHandler(supabaseClient, openAi, authenticatedOctokit, inputs);
console.log({ output });

const timestamp = new Date().getTime();
const logFilePath = path.join(__dirname, `${timestamp}.html`);

fs.writeFile(logFilePath, output, (err) => {
if (err) {
console.error("Error writing file", err);
} else {
console.log(`Output written to ${timestamp}.html`);
}
});
}

it("runs", () =>
indexTest().then(() => {
console.log("done");
}), 60000);
it(
"runs",
() =>
indexTest().then(() => {
console.log("done");
}),
60000
);