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

Refactor config #512

Merged
merged 10 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/ubiquibot-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ priority-labels:
- name: "Priority: 4 (Emergency)"
weight: 5
auto-pay-mode: true
analytics-mode: true
disable-analytics: false
comment-incentives: true
max-concurrent-bounties: 2
promotion-comment: "\n<h6>If you enjoy the DevPool experience, please follow <a href='https://github.com/ubiquity'>Ubiquity on GitHub</a> and star <a href='https://github.com/ubiquity/devpool-directory'>this repo</a> to show your support. It helps a lot!</h6>"

24 changes: 12 additions & 12 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export const getAutoPayMode = (parsedRepo?: WideRepoConfig, parsedOrg?: WideOrgC
};

export const getAnalyticsMode = (parsedRepo: WideRepoConfig | undefined, parsedOrg: WideOrgConfig | undefined): boolean => {
if (parsedRepo && parsedRepo["analytics-mode"] && typeof parsedRepo["analytics-mode"] === "boolean") {
return parsedRepo["analytics-mode"];
} else if (parsedOrg && parsedOrg["analytics-mode"] && typeof parsedOrg["analytics-mode"] === "boolean") {
return parsedOrg["analytics-mode"];
if (parsedRepo && parsedRepo["disable-analytics"] && typeof parsedRepo["disable-analytics"] === "boolean") {
return parsedRepo["disable-analytics"];
} else if (parsedOrg && parsedOrg["disable-analytics"] && typeof parsedOrg["disable-analytics"] === "boolean") {
return parsedOrg["disable-analytics"];
} else {
return false;
}
Expand All @@ -93,20 +93,20 @@ export const getPromotionComment = (parsedRepo: WideRepoConfig | undefined, pars
};

export const getIncentiveMode = (parsedRepo?: WideRepoConfig, parsedOrg?: WideOrgConfig): boolean => {
if (parsedRepo && parsedRepo["incentive-mode"] && typeof parsedRepo["incentive-mode"] === "boolean") {
return parsedRepo["incentive-mode"];
} else if (parsedOrg && parsedOrg["incentive-mode"] && typeof parsedOrg["incentive-mode"] === "boolean") {
return parsedOrg["incentive-mode"];
if (parsedRepo && parsedRepo["comment-incentives"] && typeof parsedRepo["comment-incentives"] === "boolean") {
return parsedRepo["comment-incentives"];
} else if (parsedOrg && parsedOrg["comment-incentives"] && typeof parsedOrg["comment-incentives"] === "boolean") {
return parsedOrg["comment-incentives"];
} else {
return false;
}
};

export const getBountyHunterMax = (parsedRepo: WideRepoConfig | undefined, parsedOrg: WideOrgConfig | undefined): number => {
if (parsedRepo && parsedRepo["max-concurrent-bounties"] && !Number.isNaN(Number(parsedRepo["max-concurrent-bounties"]))) {
return Number(parsedRepo["max-concurrent-bounties"]);
} else if (parsedOrg && parsedOrg["max-concurrent-bounties"] && !Number.isNaN(Number(parsedOrg["max-concurrent-bounties"]))) {
return Number(parsedOrg["max-concurrent-bounties"]);
if (parsedRepo && parsedRepo["max-concurrent-assigns"] && !Number.isNaN(Number(parsedRepo["max-concurrent-assigns"]))) {
return Number(parsedRepo["max-concurrent-assigns"]);
} else if (parsedOrg && parsedOrg["max-concurrent-assigns"] && !Number.isNaN(Number(parsedOrg["max-concurrent-assigns"]))) {
return Number(parsedOrg["max-concurrent-assigns"]);
} else {
return 2;
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export interface WideConfig {
"priority-labels"?: WideLabel[];
"auto-pay-mode"?: boolean;
"promotion-comment"?: string;
"analytics-mode"?: boolean;
"incentive-mode"?: boolean;
"max-concurrent-bounties"?: number;
"disable-analytics"?: boolean;
"comment-incentives"?: boolean;
"max-concurrent-assigns"?: number;
"comment-element-pricing"?: Record<string, number>;
}

Expand Down