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

Commit

Permalink
refactor: move to delegated compute
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Dec 10, 2023
1 parent e984244 commit dbb5d58
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 2,019 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"probot-app"
],
"scripts": {
"inspect": "node --inspect-brk ./dist/index.js",
"inspect": "node --inspect-brk ./dist/main.js",
"build:ci": "ncc build src/adapters/github/github-actions.ts -o ./",
"build:serverless": "ncc build src/index.ts -o ./",
"build": "tsc",
Expand All @@ -25,7 +25,7 @@
"start:serverless": "tsx src/adapters/github/github-actions.ts",
"start:watch": "nodemon --exec 'yarn start'",
"utils:cspell": "cspell --config .cspell.json 'src/**/*.{js,ts,json,md,yml}'",
"start": "probot run ./dist/index.js",
"start": "probot run ./dist/main.js",
"prepare": "husky install",
"test": "jest"
},
Expand Down
18 changes: 17 additions & 1 deletion src/adapters/supabase/helpers/tables/settlement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ import Decimal from "decimal.js";
import { Comment, Payload } from "../../../../types/payload";
import { Database } from "../../types/database";
import { Super } from "./super";
import { PermitTransactionData } from "../../../../handlers/comment/handlers/issue/generate-permit-2-signature";

interface PermitTransactionData {
permit: {
permitted: {
token: string;
amount: string;
};
nonce: string;
deadline: string;
};
transferDetails: {
to: string;
requestedAmount: string;
};
owner: string;
signature: string;
}

type DebitInsert = Database["public"]["Tables"]["debits"]["Insert"];
type CreditInsert = Database["public"]["Tables"]["credits"]["Insert"];
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/assign/action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getLinkedPullRequests } from "../../helpers/get-linked-issues-and-pull-requests";
import { closePullRequest } from "../../helpers/issue";
import { getLinkedPullRequests } from "../../helpers/parser";
import { calculateDurations, calculateLabelValue } from "../../helpers/shared";
import { Context } from "../../types/context";
import { Label } from "../../types/label";
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/assign/auto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAllPullRequests, getPullByNumber, getIssueByNumber, addAssignees } from "../../helpers/issue";
import { getLinkedIssues } from "../../helpers/parser";
import { getLinkedIssues } from "../../helpers/get-linked-issues-and-pull-requests";
import { addAssignees, getAllPullRequests, getIssueByNumber, getPullByNumber } from "../../helpers/issue";
import { Context } from "../../types/context";

// Check for pull requests linked to their respective issues but not assigned to them
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import Runtime from "../../../../bindings/bot-runtime";
import { checkUserPermissionForRepoAndOrg, getAllIssueComments } from "../../../../helpers/issue";
import { Context } from "../../../../types/context";
import { Comment, Issue, Payload, StateReason } from "../../../../types/payload";
import structuredMetadata from "../../../shared/structured-metadata";
import { getCollaboratorsForRepo } from "./get-collaborator-ids-for-repo";
import { getPullRequestComments } from "./get-pull-request-comments";
import Runtime from "../../../bindings/bot-runtime";
import { checkUserPermissionForRepoAndOrg, getAllIssueComments } from "../../../helpers/issue";
import { Context } from "../../../types/context";
import { Comment, Issue, Payload, StateReason } from "../../../types/payload";
import structuredMetadata from "../../shared/structured-metadata";
import { getCollaboratorsForRepo } from "./issue/get-collaborator-ids-for-repo";
import { getPullRequestComments } from "./issue/get-pull-request-comments";

export async function issueClosed(context: Context) {
// TODO: delegate permit calculation to GitHub Action

const payload = context.event.payload as Payload;
const issue = payload.issue as Issue;

Expand All @@ -18,6 +16,7 @@ export async function issueClosed(context: Context) {
// === Calculate Permit === //

const pullRequestComments = await getPullRequestComments(context, owner, repository, issueNumber);

const repoCollaborators = await getCollaboratorsForRepo(context);
const workflow = "compute.yml";
const computeRepository = "ubiquibot-config";
Expand Down
48 changes: 0 additions & 48 deletions src/handlers/comment/handlers/issue/all-comment-scoring.ts

This file was deleted.

74 changes: 0 additions & 74 deletions src/handlers/comment/handlers/issue/assignee-scoring.ts

This file was deleted.

111 changes: 0 additions & 111 deletions src/handlers/comment/handlers/issue/calculate-quality-score.test.ts

This file was deleted.

Loading

0 comments on commit dbb5d58

Please sign in to comment.