diff --git a/README.md b/README.md index baa433f4..fee74829 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Watermelon's Passive Docs Search Engine +# Watermelon's Open Source Copilot For Code Review [![Report an issue](https://img.shields.io/badge/-Report%20an%20issue-critical)](https://github.com/watermelontools/watermelon/issues) @@ -9,22 +9,17 @@ [![Twitter Follow](https://img.shields.io/twitter/follow/WatermelonTools?style=flat-square)](https://twitter.com/intent/follow?screen_name=WatermelonTools) [![Discord](https://img.shields.io/discord/933846506438541492?style=flat-square)](https://discord.com/invite/H4AE6b9442) -**Watermelon is a Passive Documentation Search Engine** serving both our GitHub app and IDE extension. Our set of plug-ins help developers understand code context, improve their coding velocity and merge PRs like a breeze. +**Watermelon is an Open Source Copilot For Code Review**. Our GitHub application allows developers to pre-review GitHub Pull Requests by tracing their code context and performing static code analysis. Using LLMs to detect errors, compare intent to implementation, and give the PR a first health check. -We've built a search algorithm that indexes the most relevant [passive documentation](https://www.watermelontools.com/post/what-is-passive-code-documentation-why-is-it-hard-to-scale-what-to-do-about-it) for a given pull request. - -To retrieve passive documentation and code context in your GitHub PRs, use this app. - -To retrieve passive documentation and code context in your IDE, take a look at our [VS Code Extension](https://github.com/watermelontools/watermelon-extension) +We've built a search algorithm that indexes the most relevant [code context](https://www.watermelontools.com/post/what-is-passive-code-documentation-why-is-it-hard-to-scale-what-to-do-about-it) for a given pull request. ## Integrations We currently support the following integrations -| Watermelon Product | Git | Project Management | Messaging | Documentation | -| :----------------- | :-------------------------------------- | :----------------- | :-------- | :----------------- | -| VS Code | GitHub, GitLab (Beta), Bitbucket (Beta) | Jira | Slack | | -| GitHub App | GitHub | Jira, Linear | Slack | Notion, Confluence | +| Git | Project Management | Messaging | Documentation | +| :-------------------------------------- | :----------------- | :-------- | :----------------- | +| GitHub | Jira, Linear, Asana | Slack | Notion, Confluence | ## Features @@ -51,18 +46,10 @@ Alternatively, comment on our issues if you plan to solve one. ## Privacy -We use [VS Code's telemetry library](https://github.com/microsoft/vscode-extension-telemetry). The library respects the user's decision about whether or not to send telemetry data. - -We also have settings to disable it. +We use [PostHog Analytics](https://posthog.com/) to track how users interact with Watermelon's GitHub Application. Watermelon [doesn't store your code](https://www.watermelontools.com/post/building-a-code-archeology-toolbox-without-storing-your-code) -## Supporters - -[![Stargazers repo roster for @watermelontools/watermelon-extension](https://reporoster.com/stars/watermelontools/watermelon)](https://github.com/watermelontools/watermelon/stargazers) - -[![Forkers repo roster for @watermelontools/watermelon-extension](https://reporoster.com/forks/watermelontools/watermelon)](https://github.com/watermelontools/watermelon/network/members) - --- #### About Watermelon diff --git a/app/api/actions/github/route.ts b/app/api/actions/github/route.ts index 73540664..4b7c1e2b 100644 --- a/app/api/actions/github/route.ts +++ b/app/api/actions/github/route.ts @@ -58,8 +58,8 @@ export async function POST(request: Request) { const { installation, repository, pull_request, organization } = req; const installationId = installation.id; const { title, body } = req.pull_request; - const owner = repository.owner.login; - const repo = repository.name; + const owner = repository?.owner?.login; + const repo = repository?.name; const number = pull_request.number; const userLogin = pull_request.user.login; @@ -68,8 +68,8 @@ export async function POST(request: Request) { let octoCommitList = await octokit.request( "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", { - repo: repository.name, - owner: repository.owner.login, + repo: repo, + owner: owner, pull_number: number, headers: { "X-GitHub-Api-Version": "2022-11-28", @@ -328,10 +328,10 @@ export async function POST(request: Request) { }); return NextResponse.json("User not registered"); } - + const team = await createTeamAndMatchUser({ - name: organization.login, - id: organization.id, + name: organization?.login || repository?.owner?.login, + id: organization?.id || repository?.owner?.id, watermelon_user, }); @@ -426,7 +426,6 @@ export async function POST(request: Request) { 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, @@ -436,7 +435,7 @@ export async function POST(request: Request) { issue_number: number, installationId, reqUrl: request.url, - reqEmail: req.email + reqEmail: req.email, }); await addActionLog({ @@ -470,7 +469,7 @@ export async function POST(request: Request) { ); // Find our bot's comment let botComment = comments.data.find((comment) => { - return comment.user.login.includes("watermelon-context"); + return comment?.user?.login.includes("watermelon-context"); }); if (botComment?.id) { // Update the existing comment @@ -536,7 +535,7 @@ export async function POST(request: Request) { // Find our bot's comment let botComment = comments.data.find((comment) => { - return comment.user.login.includes("watermelon-context"); + return comment?.user?.login.includes("watermelon-context"); }); // Update the existing comment @@ -567,6 +566,7 @@ export async function POST(request: Request) { textToWrite, }); } else if (req.action === "created" || req.action === "edited") { + console.log("comment keys", Object.keys(req)); const { missingParams } = validateParams(req, [ "installation", "repository", diff --git a/utils/actions/detectConsoleLogs.ts b/utils/actions/detectConsoleLogs.ts index a05a065e..f01a1ee5 100644 --- a/utils/actions/detectConsoleLogs.ts +++ b/utils/actions/detectConsoleLogs.ts @@ -163,6 +163,7 @@ export default async function detectConsoleLogs({ filePatch: file.patch ?? "", individualLine }) + return octokit.request( "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews", { @@ -176,7 +177,6 @@ export default async function detectConsoleLogs({ { path: file.filename, position: consoleLogPosition || 1, // comment at the beggining of the file by default - body: "This file contains at least one console log. Please remove any present.", }, ],