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

E2E tests #640

Open
wants to merge 18 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"node-html-to-image": "^3.3.0",
"nodemon": "^2.0.19",
"octokit": "^3.1.0",
"parse5": "^7.1.2",
0x4007 marked this conversation as resolved.
Show resolved Hide resolved
"prettier": "^2.7.1",
"probot": "^12.2.4",
"telegraf": "^4.11.2",
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/access/labels-access.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getAccessLevel } from "../../adapters/supabase";
import { getBotConfig, getBotContext, getLogger } from "../../bindings";
import { addCommentToIssue, getUserPermission, removeLabel, addLabelToIssue } from "../../helpers";
import { Payload } from "../../types";
import { Payload, UserType } from "../../types";

export const handleLabelsAccess = async () => {
const { accessControl } = getBotConfig();
Expand All @@ -12,6 +12,7 @@ export const handleLabelsAccess = async () => {
const payload = context.payload as Payload;
if (!payload.issue) return;
if (!payload.label?.name) return;
if (payload.sender.type === UserType.Bot) return true;
const sender = payload.sender.login;
const repo = payload.repository;
const permissionLevel = await getUserPermission(sender, context);
Expand Down
33 changes: 32 additions & 1 deletion src/handlers/payout/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Incentives, MarkdownItem, Payload, StateReason, UserType } from "../../
import { commentParser } from "../comment";
import Decimal from "decimal.js";
import { bountyInfo } from "../wildcard";
import { GLOBAL_STRINGS } from "../../configs";

const ItemsToExclude: string[] = [MarkdownItem.BlockQuote];
/**
Expand Down Expand Up @@ -55,6 +56,20 @@ export const incentivizeComments = async () => {
return;
}

for (const botComment of comments.filter((cmt) => cmt.user.type === UserType.Bot).reverse()) {
const botCommentBody = botComment.body;
if (botCommentBody.includes(GLOBAL_STRINGS.autopayComment)) {
const pattern = /\*\*(\w+)\*\*/;
const res = botCommentBody.match(pattern);
if (res) {
if (res[1] === "false") {
return;
}
break;
}
}
}

rndquu marked this conversation as resolved.
Show resolved Hide resolved
const assignees = issue?.assignees ?? [];
const assignee = assignees.length > 0 ? assignees[0] : undefined;
if (!assignee) {
Expand Down Expand Up @@ -120,7 +135,9 @@ export const incentivizeComments = async () => {
logger.info(`Permit url generated for contributors. reward: ${JSON.stringify(reward)}`);
logger.info(`Skipping to generate a permit url for missing accounts. fallback: ${JSON.stringify(fallbackReward)}`);

await addCommentToIssue(comment, issue.number);
if (Object.keys(reward).length > 0) {
await addCommentToIssue(comment, issue.number);
}
};

export const incentivizeCreatorComment = async () => {
Expand Down Expand Up @@ -174,6 +191,20 @@ export const incentivizeCreatorComment = async () => {
return;
}

for (const botComment of comments.filter((cmt) => cmt.user.type === UserType.Bot).reverse()) {
const botCommentBody = botComment.body;
if (botCommentBody.includes(GLOBAL_STRINGS.autopayComment)) {
const pattern = /\*\*(\w+)\*\*/;
const res = botCommentBody.match(pattern);
if (res) {
if (res[1] === "false") {
return;
}
break;
}
}
}

const description = await getIssueDescription(issue.number, "html");
if (!description) {
logger.info(`Skipping to generate a permit url because issue description is empty. description: ${description}`);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface CommandObj {
export interface WideConfig {
"evm-network-id"?: number;
"price-multiplier"?: number;
"issue-creator-multiplier": number;
"issue-creator-multiplier"?: number;
"time-labels"?: WideLabel[];
"priority-labels"?: WideLabel[];
"payment-permit-max-price"?: number;
Expand Down
Loading