Skip to content

Commit

Permalink
feat: add a new config param
Browse files Browse the repository at this point in the history
Signed-off-by: Wenhao Ho <[email protected]>
  • Loading branch information
whck6 committed Aug 27, 2024
1 parent 930c45e commit 7fa0ead
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/adapters/supabase/helpers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class User extends Super {

async getWalletByUserId(userId: number, issueNumber: number) {
const { data, error } = (await this.supabase.from("users").select("wallets(*)").eq("id", userId).single()) as { data: { wallets: Wallet }; error: unknown };
if (this.context.config.emptyWalletText) {
return null;
}
if ((error && !data) || !data.wallets?.address) {
this.context.logger.error("No wallet address found", { userId, issueNumber });
if (this.context.config.startRequiresWallet) {
Expand Down
1 change: 1 addition & 0 deletions src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const startStopSchema = T.Object(
taskStaleTimeoutDuration: T.String({ default: "30 Days" }),
maxConcurrentTasks: T.Number({ default: 3 }),
startRequiresWallet: T.Boolean({ default: true }),
emptyWalletText: T.Boolean({ default: false }),
},
{
default: {},
Expand Down
1 change: 1 addition & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ function createContext(issue: Record<string, unknown>, sender: Record<string, un
taskStaleTimeoutDuration: "30 Days",
maxConcurrentTasks: 3,
startRequiresWallet: false,
emptyWalletText: true,
},
octokit: new octokit.Octokit(),
eventName: "issue_comment.created" as SupportedEventsU,
Expand Down

0 comments on commit 7fa0ead

Please sign in to comment.