From ed023ba055c49e151a62c68728ec058eef02d50c Mon Sep 17 00:00:00 2001 From: whilefoo Date: Wed, 20 Sep 2023 10:42:07 +0200 Subject: [PATCH] feat: add config --- src/configs/ubiquibot-config-default.ts | 15 ++++++++++++++- src/handlers/payout/post.ts | 2 +- src/types/config.ts | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/configs/ubiquibot-config-default.ts b/src/configs/ubiquibot-config-default.ts index af8aa18bf..6975e51f0 100644 --- a/src/configs/ubiquibot-config-default.ts +++ b/src/configs/ubiquibot-config-default.ts @@ -83,7 +83,20 @@ export const DefaultConfig: MergedConfig = { ], incentives: { comment: { - elements: {}, + issue: { + assignee: false, + creator: false, + default: true, + }, + pullRequest: { + assignee: false, + creator: false, + reviewer: true, + default: true, + }, + elements: { + p: 0.1, + }, totals: { word: 0, }, diff --git a/src/handlers/payout/post.ts b/src/handlers/payout/post.ts index 4db4530ea..0558ee6b0 100644 --- a/src/handlers/payout/post.ts +++ b/src/handlers/payout/post.ts @@ -417,7 +417,7 @@ const calculateRewardValue = (comments: Record, incentiv return sum; }; -const MarkdownItemToHTMLTag: Record = { +const MarkdownItemToHTMLTag: Record = { [MarkdownItem.Text]: HTMLItem.P, [MarkdownItem.Paragraph]: HTMLItem.P, [MarkdownItem.Heading]: HTMLItem.H1, diff --git a/src/types/config.ts b/src/types/config.ts index b4dedf3d0..16851bc96 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -13,6 +13,23 @@ export type LabelItem = Static; const CommentIncentivesSchema = Type.Object( { + issue: Type.Object( + { + assignee: Type.Boolean(), + creator: Type.Boolean(), + default: Type.Boolean(), + }, + { additionalProperties: false } + ), + pullRequest: Type.Object( + { + assignee: Type.Boolean(), + creator: Type.Boolean(), + reviewer: Type.Boolean(), + default: Type.Boolean(), + }, + { additionalProperties: false } + ), elements: Type.Record(Type.String(), Type.Number()), totals: Type.Object( {