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

Commit

Permalink
Make calls to other services concurrent (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanDalelR committed Nov 14, 2023
1 parent 5b8ab6f commit 25c4f93
Showing 1 changed file with 50 additions and 41 deletions.
91 changes: 50 additions & 41 deletions app/api/actions/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,48 +413,55 @@ export async function POST(request: Request) {
repoName: repo,
});
textToWrite += randomText();

// Detect console.logs and its equivalent in other languages
await detectConsoleLogs({
prTitle: title,
businessLogicSummary,
repo,
owner,
issue_number: number,
installationId,
reqUrl: request.url,
reqEmail: req.email,
});

// Make Watermelon Review the PR's business logic here by comparing the title with the AI-generated summary
await labelPullRequest({
prTitle: title,
businessLogicSummary,
repo,
owner,
issue_number: number,
installationId,
reqUrl: request.url,
reqEmail: req.email,
Promise.all([
// Detect console.logs and its equivalent in other languages
detectConsoleLogs({
prTitle: title,
businessLogicSummary,
repo,
owner,
issue_number: number,
installationId,
reqUrl: request.url,
reqEmail: req.email,
}),
// Make Watermelon Review the PR's business logic here by comparing the title with the AI-generated summary
labelPullRequest({
prTitle: title,
businessLogicSummary,
repo,
owner,
issue_number: number,
installationId,
reqUrl: request.url,
reqEmail: req.email,
}),
addActionLog({
randomWords,
github,
jira,
slack,
notion,
linear,
asana,
textToWrite,
businessLogicSummary,
owner,
repo,
number,
payload: req,
count,
watermelon_user,
}),
]).catch((error) => {
failedPosthogTracking({
url: request.url,
error: error.message,
email: req.email,
});
return console.error("posting comment error", error);
});

await addActionLog({
randomWords,
github,
jira,
slack,
notion,
linear,
asana,
textToWrite,
businessLogicSummary,
owner,
repo,
number,
payload: req,
count,
watermelon_user,
});
// Fetch all comments on the PR
const comments = await octokit.request(
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments?sort=created&direction=desc",
Expand All @@ -469,7 +476,9 @@ export async function POST(request: Request) {
);
// Find our bot's comment
let botComment = comments.data.find((comment) => {
return comment?.user?.login.includes("watermelon-copilot-for-code-review");
return comment?.user?.login.includes(
"watermelon-copilot-for-code-review"
);
});
if (botComment?.id) {
// Update the existing comment
Expand Down

0 comments on commit 25c4f93

Please sign in to comment.