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

Commit

Permalink
Fix max (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanDalelR authored Dec 26, 2023
1 parent 336e40b commit 99c0da8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
35 changes: 0 additions & 35 deletions app/api/actions/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,41 +551,6 @@ export async function POST(request: Request) {
});
}

// If the count is surpassed, we replace the
if (count.github_app_uses > 500) {
textToWrite = `Your team has surpassed the free monthly usage. [Please click here](https://buy.stripe.com/28o0289KVaYV5wY004) to upgrade.`;

const comments = await octokit.request(
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments?sort=created&direction=desc",
{
owner,
repo,
issue_number: number,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
}
);

// Find our bot's comment
let botComment = comments.data.find((comment) => {
return comment?.user?.login.includes(
"watermelon-copilot-for-code-review"
);
});

// Update the existing comment
await octokit.request(
"PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}",
{
owner,
repo,
comment_id: botComment.id,
body: textToWrite,
}
);
}

successPosthogTracking({
url: request.url,
email: user_email,
Expand Down
3 changes: 3 additions & 0 deletions utils/actions/markdownHelpers/count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const countMarkdown = ({
if (count.error) {
return `\n We're sorry, we ran into an error: ${count.error}`;
} else {
if (count.name && count.github_app_uses > 500) {
return `Your team has surpassed the free monthly usage. [Please click here](https://buy.stripe.com/28o0289KVaYV5wY004) to upgrade.`;
}
if (count.name && count.github_app_uses) {
return `\n Your team ${count.name} has used Watermelon ${count.github_app_uses} times.`;
}
Expand Down

0 comments on commit 99c0da8

Please sign in to comment.