Skip to content

Commit

Permalink
feat: add config
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Sep 20, 2023
1 parent 9e88f65 commit ed023ba
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/configs/ubiquibot-config-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/payout/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ const calculateRewardValue = (comments: Record<MarkdownItem, string[]>, incentiv
return sum;
};

const MarkdownItemToHTMLTag: Record<MarkdownItem, string> = {
const MarkdownItemToHTMLTag: Record<MarkdownItem, HTMLItem> = {
[MarkdownItem.Text]: HTMLItem.P,
[MarkdownItem.Paragraph]: HTMLItem.P,
[MarkdownItem.Heading]: HTMLItem.H1,
Expand Down
17 changes: 17 additions & 0 deletions src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ export type LabelItem = Static<typeof LabelItemSchema>;

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(
{
Expand Down

0 comments on commit ed023ba

Please sign in to comment.