Skip to content

Commit

Permalink
chore: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Feb 17, 2024
1 parent 29de0ee commit 32db575
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 91 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@types/ms": "^0.7.31",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/typescript-estree": "^7.0.1",
"@uniswap/permit2-sdk": "^1.2.0",
"@vercel/ncc": "^0.34.0",
"ajv": "^8.12.0",
Expand All @@ -55,6 +56,7 @@
"ms": "^2.1.3",
"node-html-parser": "^6.1.5",
"nodemon": "^2.0.19",
"npm-run-all": "^4.1.5",
"openai": "^4.2.0",
"prettier": "^2.7.1",
"probot": "^12.2.4",
Expand Down
30 changes: 3 additions & 27 deletions src/adapters/supabase/helpers/tables/locations.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SupabaseClient } from "@supabase/supabase-js";
import { Super } from "./super";
// import { Database } from "../../types/database";
import { Database } from "../../types/database";

// currently trying to save all of the location metadata of the event.
// seems that focusing on the IssueComments will provide the most value

// type LocationsRow = Database["public"]["Tables"]["logs"]["Row"];
type LocationsRow = Database["public"]["Tables"]["logs"]["Row"];
export class Locations extends Super {
locationResponse: LocationResponse | undefined;
locationResponse: LocationsRow | undefined;

user_id: string | undefined;
comment_id: string | undefined;
Expand All @@ -30,27 +30,3 @@ export class Locations extends Super {
return locationData;
}
}

interface LocationResponse {
data: {
node: {
id: "IC_kwDOH92Z-c5oA5cs";
author: {
login: "molecula451";
id: "MDQ6VXNlcjQxNTUyNjYz";
};
issue: {
id: "I_kwDOH92Z-c5yRpyq";
number: 846;
repository: {
id: "R_kgDOH92Z-Q";
name: "ubiquibot";
owner: {
id: "MDEyOk9yZ2FuaXphdGlvbjc2NDEyNzE3";
login: "ubiquity";
};
};
};
};
};
}
8 changes: 1 addition & 7 deletions src/bindings/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
MainActionHandler,
PostActionHandler,
PreActionHandler,
WildCardHandler
WildCardHandler,
} from "../types/handlers";
import { GitHubEvent, GitHubPayload, payloadSchema } from "../types/payload";
import { ajv } from "../utils/ajv";
Expand Down Expand Up @@ -246,12 +246,6 @@ function createRenderCatchAll(context: Context, handlerType: AllHandlersWithType
);
} else {
// could be supabase error
// interface SupabaseError {
// code: "PGRST116";
// details: "The result contains 0 rows";
// hint: null;
// message: "JSON object requested, multiple (or no) rows returned";
// }

// report as SupabaseError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Octokit } from "@octokit/rest";
import { Context } from "../../../../types/context";
import { GitHubEvent, GitHubUser } from "../../../../types/payload";

interface WorkflowDispatchOptions {
org: string;
Expand All @@ -14,7 +13,7 @@ async function getInstallationOctokitForOrg(context: Context, org: string) {
// You might need to adapt this part based on the actual event type your app handles
const installations = await context.octokit.apps.listInstallations();
// context.logger.debug("installations", installations);
const installation = installations.data.find((inst) => inst.account?.login === org) as ExampleResponse;
const installation = installations.data.find((inst) => inst.account?.login === org);
// context.logger.debug("installation", installation);

if (!installation) {
Expand All @@ -28,10 +27,9 @@ async function getInstallationOctokitForOrg(context: Context, org: string) {
}

export async function dispatchWorkflow(context: Context, options: WorkflowDispatchOptions) {
const installationOctokit = (await getInstallationOctokitForOrg(
context,
options.org
)) as unknown as ExampleInstallation; // I took a real response so ignore this type cast.
const installationOctokit = (await getInstallationOctokitForOrg(context, options.org)) as InstanceType<
typeof Octokit
> & { token: string };

context.logger.debug("installationOctokit", installationOctokit);
const authenticatedOctokit = new Octokit({ auth: installationOctokit.token });
Expand All @@ -46,54 +44,3 @@ export async function dispatchWorkflow(context: Context, options: WorkflowDispat
inputs: options.inputs,
});
}

interface ExampleResponse {
id: 37628281;
account: GitHubUser;
repository_selection: "all";
access_tokens_url: "https://api.github.com/app/installations/37628281/access_tokens";
repositories_url: "https://api.github.com/installation/repositories";
html_url: "https://github.com/organizations/ubiquibot/settings/installations/37628281";
app_id: 236521;
app_slug: "ubiquibot";
target_id: 133917611;
target_type: "Organization";
permissions: {
issues: "write";
actions: "write";
members: "read";
contents: "write";
metadata: "read";
pull_requests: "write";
};
events: GitHubEvent[];
created_at: "2023-05-17T20:52:25.000Z";
updated_at: "2023-12-23T09:58:37.000Z";
single_file_name: null;
has_multiple_single_files: false;
single_file_paths: [];
suspended_by: null;
suspended_at: null;
caller: "getInstallationOctokitForOrg";
revision: "4c15837";
}

interface ExampleInstallation {
type: "token";
tokenType: "installation";
token: "ghs_Pm5WyIfH7OjYg6uDv9MQGflRuaGeub2LYHu9";
installationId: 37628281;
permissions: {
members: "read";
actions: "write";
contents: "write";
issues: "write";
metadata: "read";
pull_requests: "write";
};
createdAt: "2023-12-23T15:08:59.876Z";
expiresAt: "2023-12-23T16:08:59Z";
repositorySelection: "all";
caller: "dispatchWorkflow";
revision: "4c15837";
}

0 comments on commit 32db575

Please sign in to comment.