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

v2.1.5 #401

Merged
merged 163 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
fc8b365
fix: upgrade airtable from 0.11.6 to 0.12.1
snyk-bot Sep 2, 2023
b9029f6
Fix/v2.0.0 merge conflicts (#278)
EstebanDalelR Sep 4, 2023
c0a6103
Merge branch 'dev' into snyk-upgrade-2fb799419e235800c37aacf6ded49ad0
EstebanDalelR Sep 4, 2023
9a29a68
Build a prompt that produces the desired results
baristaGeek Sep 5, 2023
86c81f7
Flag PRs
baristaGeek Sep 5, 2023
4d0b5bc
Change comparison string for detecting already labeled PRs
baristaGeek Sep 5, 2023
1d246b0
Fix/double cloud id getting (#271)
EstebanDalelR Sep 5, 2023
835e833
Change hardcoded pr title and number to the ones stored on GitHubPRs[0
baristaGeek Sep 5, 2023
aa3ce80
Remove console logs
baristaGeek Sep 5, 2023
6bbba41
Chore/delete unused files (#283)
EstebanDalelR Sep 6, 2023
b174fd6
Feature/new integrations script (#272)
EstebanDalelR Sep 6, 2023
30dabb9
Feature/asana integration (#273)
EstebanDalelR Sep 7, 2023
25e1350
Move logic to actions/github
baristaGeek Sep 7, 2023
7aa4cad
Fix parameter names
baristaGeek Sep 7, 2023
415b917
Merge pull request #275 from watermelontools/snyk-upgrade-2fb799419e2…
baristaGeek Sep 7, 2023
7095af1
Merge branch 'dev' into feature/Watermelon-as-reviewer-0
baristaGeek Sep 8, 2023
63bcbbb
Feature/improve logging (#291)
EstebanDalelR Sep 11, 2023
8ccb1c7
Feature/streamline new integrations (#292)
EstebanDalelR Sep 11, 2023
5c5c103
Remove running in the extension
baristaGeek Sep 11, 2023
ee21e0d
Run sync
baristaGeek Sep 12, 2023
033e3eb
Change threshold back to 9
baristaGeek Sep 12, 2023
d05c0f3
Update route.ts (#296)
EstebanDalelR Sep 13, 2023
9aaa301
Update route.ts (#295)
EstebanDalelR Sep 13, 2023
62ab841
Update responses.ts (#294)
EstebanDalelR Sep 13, 2023
1b2c123
Update redirect.tsx (#293)
EstebanDalelR Sep 13, 2023
82a2093
Feature/intellij login (#286)
EstebanDalelR Sep 13, 2023
fcb992d
Refactor Watermelon as reviewer 0 to work sync and prevent race condi…
baristaGeek Sep 13, 2023
0e13788
Remove user prompt
baristaGeek Sep 13, 2023
058f1a2
Couple logic inside a single function
baristaGeek Sep 13, 2023
047d4d1
Merge branch 'dev' into feature/Watermelon-as-reviewer-0
baristaGeek Sep 13, 2023
aa99e79
Feature/intellij data mapping (#298)
EstebanDalelR Sep 14, 2023
f433f20
Make function async again, use installation octokit, and add auto lab…
baristaGeek Sep 14, 2023
2211ba9
Track pr rating per repo on PostHog
baristaGeek Sep 14, 2023
229e3d0
Add param validation
baristaGeek Sep 14, 2023
9693c5d
Merge branch 'dev' into feature/Watermelon-as-reviewer-0
EstebanDalelR Sep 14, 2023
9d37d0f
Merge pull request #282 from watermelontools/feature/Watermelon-as-re…
baristaGeek Sep 14, 2023
ef4d61b
Feature/encapsulated tracking (#297)
EstebanDalelR Sep 14, 2023
4569bd6
Chore/2.0.1 merge conflicts (#299)
EstebanDalelR Sep 14, 2023
f0458e2
Merge branch 'main' into dev
EstebanDalelR Sep 14, 2023
c4e9644
v2.0.1 (#281) (#300)
EstebanDalelR Sep 14, 2023
eccc506
Add date to textToWrite for the GitHub service
baristaGeek Sep 19, 2023
7647a25
Calculate relative date
baristaGeek Sep 19, 2023
7fe4841
Print PR author
baristaGeek Sep 19, 2023
1ef114e
Remove conole logs
baristaGeek Sep 19, 2023
0e09202
Remove organization as a mandtory paramater for running the GH app (#…
baristaGeek Sep 20, 2023
d6f99d6
REmove github special case
EstebanDalelR Sep 20, 2023
51dfe6f
Fix helper text
EstebanDalelR Sep 20, 2023
eb45693
REmove github special case (#303)
EstebanDalelR Sep 20, 2023
0f4e18f
Merge branch 'dev' into fix/broken-deactivation-text
EstebanDalelR Sep 20, 2023
7fbb7af
Merge pull request #304 from watermelontools/fix/broken-deactivation-…
baristaGeek Sep 20, 2023
1ac634b
Merge branch 'dev' into feature/add-ownership-and-date
baristaGeek Sep 20, 2023
3f91367
Merge pull request #301 from watermelontools/feature/add-ownership-an…
baristaGeek Sep 20, 2023
efc1be6
Add conditional if the count passes 500
baristaGeek Sep 22, 2023
e0d2894
Feature/unauthorized tracking (#309)
EstebanDalelR Sep 22, 2023
8b376fe
Feature/random suggestion text on markdown (#310)
EstebanDalelR Sep 22, 2023
5404ad4
Replace all indexed information with invitation to pay
baristaGeek Sep 25, 2023
7e1ad3d
Remove the logic from the markdown helper
baristaGeek Sep 25, 2023
04f185a
Feature/intellijdownload (#312)
EstebanDalelR Sep 26, 2023
9fdaa47
Remove console log
baristaGeek Sep 26, 2023
e20efd1
Unwrapp comenting logic from being below the threshold. Replace comme…
baristaGeek Sep 26, 2023
44bf4ef
Create and call the new stored procedure (increment_owner_github_app_…
baristaGeek Sep 26, 2023
ef7dc57
Merge pull request #311 from watermelontools/bugfix/bugfix-not-showin…
baristaGeek Sep 27, 2023
84c0dd8
Merge branch 'dev' into bugfix/user-or-org-to-gh-app
baristaGeek Sep 27, 2023
a6b47ba
Merge pull request #313 from watermelontools/bugfix/user-or-org-to-gh…
baristaGeek Sep 27, 2023
3474cb0
Allow empty responses (#317)
EstebanDalelR Sep 28, 2023
c0932ed
Make prompt multi-line to make its iteration easier
baristaGeek Oct 10, 2023
cd57b53
Bias prompt towards conciseness
baristaGeek Oct 10, 2023
70b92ef
Remove role user prompt for simplicity
baristaGeek Oct 10, 2023
c78988e
Merge into a single prompt, and bias the prompt even more towards con…
baristaGeek Oct 10, 2023
3b5a068
Remove github param validation because of the recent permission changes
baristaGeek Oct 10, 2023
52784fe
Remove prod console logs
baristaGeek Oct 10, 2023
0a18c09
Add logic that removes outdated PR labels
baristaGeek Oct 10, 2023
3aff27c
Change the take a deeper dive label emoji
baristaGeek Oct 10, 2023
cca1d2c
Merge pull request #322 from watermelontools/feature/trinary-pr-labeling
baristaGeek Oct 11, 2023
dab95a9
console.log() file patches
baristaGeek Oct 11, 2023
e336e75
Detect console logs and its equivalent in other programming languages…
baristaGeek Oct 11, 2023
fd187fe
Comment the PR if there's a console log detected
baristaGeek Oct 13, 2023
ec591fa
Remove console logs
baristaGeek Oct 13, 2023
161bc91
remove console log
baristaGeek Oct 17, 2023
9d68579
update prompt
baristaGeek Oct 17, 2023
0a3a481
update prompt
baristaGeek Oct 17, 2023
63b0933
Extract functions and texts (#323) (#325)
EstebanDalelR Oct 17, 2023
b937bf3
Ommit console logs that are in code comments
baristaGeek Oct 17, 2023
81380cd
remove old logic
baristaGeek Oct 17, 2023
c01fb42
Restric rating to a maximum of 8 if console log comments are found
baristaGeek Oct 17, 2023
c86a96a
Merge the commits into the prompt list
baristaGeek Oct 18, 2023
48970fb
Update utils/actions/detectConsoleLogs.ts
baristaGeek Oct 18, 2023
d69514b
Promise.allSettled octokit call
baristaGeek Oct 18, 2023
ab41609
Merge branch 'dev' into feature/search-console-logs
baristaGeek Oct 18, 2023
3eb21e2
Concat with different syntax
baristaGeek Oct 18, 2023
955413a
fix merge conflict
baristaGeek Oct 18, 2023
d642ac4
Merge pull request #324 from watermelontools/feature/search-console-logs
baristaGeek Oct 18, 2023
afb3999
Chore/extract PR grading (#333)
EstebanDalelR Oct 23, 2023
df0bb3e
bring the user prompt back
baristaGeek Oct 23, 2023
28a53a4
Add consistent CSS for boxes regardless of login state + prettify design
baristaGeek Oct 25, 2023
b361795
Style the boxes for all integrations
baristaGeek Oct 25, 2023
cfe74c9
Merge pull request #321 from watermelontools/enhancement/improve-prom…
baristaGeek Oct 25, 2023
2fd51f0
Make IDE boxes consistenet with the integraitons boxes
baristaGeek Oct 25, 2023
b86be53
Rebuild sidebar
baristaGeek Oct 25, 2023
8e33d77
Redesign the header
baristaGeek Oct 25, 2023
cf21362
Make final adjustments to header
baristaGeek Oct 25, 2023
894cc1a
Make instruction more specific and add the C++ exmaple
baristaGeek Oct 25, 2023
c62f679
Merge pull request #340 from watermelontools/chore/detect-cpp-console…
baristaGeek Oct 26, 2023
36bfcfd
Create getTeamGitHub.ts (#338)
EstebanDalelR Oct 26, 2023
eae03a0
Create createTeamAndMatchUser.ts (#337)
EstebanDalelR Oct 26, 2023
eaa2ec6
Conditionally render placeholder (#342)
EstebanDalelR Oct 26, 2023
7925771
Feature/comment specific line diffs (#331)
baristaGeek Oct 26, 2023
72b539f
Watermelon using app token (team tool) (#326)
EstebanDalelR Oct 26, 2023
fd21a53
Re-style team page
baristaGeek Oct 27, 2023
ec94f5d
Style settings screen
baristaGeek Oct 27, 2023
ace2080
Merge branch 'dev' into enhancement/beautify-dashboard
baristaGeek Oct 27, 2023
4ad49a4
Pull changes
baristaGeek Oct 27, 2023
9c07826
Merge pull request #339 from watermelontools/enhancement/beautify-das…
baristaGeek Oct 27, 2023
78eac4c
Merge branch 'main' into dev
baristaGeek Oct 27, 2023
8d8c315
Fix indexing issue for the single line file border-case (#346)
baristaGeek Oct 30, 2023
4739d5b
Delete app/(loggedIn)/settings/layout.tsx (#348)
EstebanDalelR Oct 30, 2023
adcc4a9
Add tracking to keys existing
EstebanDalelR Oct 31, 2023
5015186
Fix/broken login getting (#353)
EstebanDalelR Oct 31, 2023
3d25273
Chore/readme update messaging and strategy (#352)
baristaGeek Oct 31, 2023
754aeea
Merge branch 'main' into dev
EstebanDalelR Oct 31, 2023
07d6a42
Fix/add catches to octokit (#359)
EstebanDalelR Nov 2, 2023
d4dbf41
Fix/missing params when a comment is created or edited (#358)
EstebanDalelR Nov 2, 2023
d55a869
Delete public/favicon_io.zip (#357)
EstebanDalelR Nov 2, 2023
fd615b1
Merge branch 'main' into dev
EstebanDalelR Nov 2, 2023
822ed7a
Add random files
baristaGeek Nov 3, 2023
c5e9d46
Add a space to WatermelonAI summary title
baristaGeek Nov 3, 2023
af00550
Search for new app name to avoid duplicate comments
baristaGeek Nov 3, 2023
a340702
Remove test files (I messed up)
baristaGeek Nov 3, 2023
9938292
Delete public/questionsHappyTulia.png (#361)
EstebanDalelR Nov 3, 2023
0fc9057
Merge pull request #362 from watermelontools/bugfix/duplicate-pr-comm…
baristaGeek Nov 7, 2023
6b74050
Update model to GPT4-turbo (#365)
EstebanDalelR Nov 9, 2023
5450bb6
Pin Next version to 13
EstebanDalelR Nov 10, 2023
5b8ab6f
Add the ruby case, and add the [input=email] string as a counter example
baristaGeek Nov 10, 2023
25c4f93
Make calls to other services concurrent (#375)
EstebanDalelR Nov 14, 2023
769ce19
Merge branch 'main' into dev
EstebanDalelR Nov 15, 2023
5c2427e
Fix/prevent double console log commenting (#377)
EstebanDalelR Nov 15, 2023
4817f85
Feature/uninstall email (#366)
EstebanDalelR Nov 15, 2023
9098ee9
Change all watermelon-context references to watermelon-copilot-for-co…
baristaGeek Nov 20, 2023
6255bca
Create dependabot.yml
baristaGeek Nov 20, 2023
0c5cd93
Merge pull request #387 from watermelontools/baristaGeek-patch-5
baristaGeek Nov 20, 2023
6795e85
Return 400 if PR author user type is a bot
baristaGeek Nov 20, 2023
ec51510
REmove commons clause
baristaGeek Nov 20, 2023
fff3cfe
Comment GitLab and Bitbucket login links
baristaGeek Nov 20, 2023
99fa05e
Remove IDEs from the login grid
baristaGeek Nov 20, 2023
635513b
Remove VS Code link from header
baristaGeek Nov 20, 2023
d68e934
Remove references to IDE extensions on the random text
baristaGeek Nov 20, 2023
af12329
Fix undefined team url (#384)
EstebanDalelR Nov 21, 2023
817161c
Merge pull request #386 from watermelontools/bugfix/multiple-comments
baristaGeek Nov 21, 2023
f5ce673
Merge pull request #389 from watermelontools/docs/remove-commons-clause
baristaGeek Nov 21, 2023
34d9ba5
Remove comments
baristaGeek Nov 21, 2023
1e29ed0
Merge pull request #390 from watermelontools/chore/remove-unused-pieces
baristaGeek Nov 21, 2023
073cea3
Merge pull request #388 from watermelontools/bugfix-373/deactivate-co…
baristaGeek Nov 21, 2023
156aaf3
Fix stored procedure call
baristaGeek Nov 27, 2023
d62f2ec
Add idiomatic name to the stored procedure that updates github usage …
baristaGeek Nov 27, 2023
a862399
Remove prod console log
baristaGeek Nov 27, 2023
3950d08
Add bugfix and its derivatives as stopwords
baristaGeek Nov 28, 2023
d37e074
Update README.md
baristaGeek Nov 28, 2023
1e5018a
Merge pull request #395 from watermelontools/bugfix/new-counter
baristaGeek Nov 28, 2023
0d5e953
Merge pull request #396 from watermelontools/chore/add-bugfix-as-a-se…
baristaGeek Nov 29, 2023
b44ba29
Upgrade GPT in detectConsoleLogs.ts (#398)
EstebanDalelR Nov 30, 2023
cfae6ed
Update pull_request_template.md (#400)
EstebanDalelR Dec 5, 2023
71a236c
Update README.md
baristaGeek Dec 8, 2023
b80d9e1
Merge pull request #408 from watermelontools/baristaGeek-patch-6
baristaGeek Dec 11, 2023
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
15 changes: 0 additions & 15 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
“Commons Clause” License Condition v1.0

The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.

Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.

For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.

Software: [Watermelon]

License: [Apache 2.0 License]

Licensor: [Watermelon Tools, Inc.]


Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ We currently support the following integrations
## Features

Watermelon's GitHub application allows teams to contextualize pull requests with code context from different sources.
<img width="907" alt="contextualization" src="https://github.com/watermelontools/watermelon/assets/8325094/36816e03-869f-4f2d-9ce6-115ce9c52a01">

![watermelon-github-application](https://marketplace-screenshots.githubusercontent.com/15256/0b80188e-a25b-4fb1-946b-5320dd0f4744?auto=webp&format=jpeg&width=670&dpr=2)
Our GitHub application also identifies errors in your codebase. Beginning with the detection of console logs (and their equivalents across various major programming languages), Watermelon comments PR line diffs whenever an error is detected. Expanded capabilities in identifying a broader range of errors soon.
<img width="797" alt="linediff" src="https://github.com/watermelontools/watermelon/assets/8325094/aba15b7e-f9a5-4e4a-86de-dfe04aac7551">


Finally, our GitHub app uses "LLMs as Reviewer Zero". Watermelon evaluates the traced code context against the intent of the Pull Request. Based on these insights, it labels them as "🍉 Safe To Merge", "👀 Take a Deeper Dive", or "🚨 Don't Merge".
<img width="777" alt="prereview" src="https://github.com/watermelontools/watermelon/assets/8325094/742191f1-3505-453e-bd47-f1f2dea545c8">

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion app/(loggedIn)/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function loading({}) {
<>
<>
<LoginGrid userEmail={userEmail} data={fakeData} />
<a href="https://github.com/apps/watermelon-context" target="_blank">
<a href="https://github.com/apps/watermelon-copilot-for-code-review" target="_blank">
<div className="Box d-flex flex-items-center flex-justify-start m-3 p-2">
<img className="avatar avatar-8" src="/logos/watermelon.svg" />
<div className="p-2">
Expand Down
77 changes: 1 addition & 76 deletions app/(loggedIn)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,85 +17,10 @@ async function HomePage({}) {
console.error(e);
return null;
});
const comingSoon = [
"IntelliJ",
"Android Studio",
"AppCode",
"Aqua",
"CLion",
"DataGrip",
"DataSpell",
"GoLand",
"MPS",
"PhpStorm",
"PyCharm",
"Rider",
"RubyMine",
"RustRover",
"WebStorm",
];

return (
<div>
{data && <LoginGrid userEmail={userEmail} data={data} />}
{userEmail && (
<div className="Box" style={{ height: "100%" }}>
<div className="Subhead px-3 pt-2">
<h2 className="Subhead-heading d-flex flex-items-center flex-justify-start">
<img className="avatar avatar-4" src="/logos/vscode.svg" />
<span>IDEs</span>
</h2>
</div>

<div
style={{
display: "grid",
gridTemplateColumns: "repeat(auto-fit, minmax(350px, 1fr))",
}}
>
<div className="pl-3 pr-3 pt-1 pb-3" style={{ flex: 1 }}>
<DownloadExtension
name="VSCode"
email={userEmail}
urlStart="vscode"
accessToken={userName}
/>
</div>

<div className="pl-3 pr-3 pt-1 pb-3" style={{ flex: 1 }}>
<DownloadExtension
name="VSCode Insiders"
urlStart="vscode-insiders"
email={userEmail}
accessToken={userName}
/>
</div>
<div className="pl-3 pr-3 pt-1 pb-3" style={{ flex: 1 }}>
<DownloadExtension
name="VSCodium"
urlStart="vscodium"
email={userEmail}
accessToken={userName}
/>
</div>
{comingSoon.map((name) => (
<a href="https://plugins.jetbrains.com/plugin/22720-watermelon-context">
<div className="p-3">
<div className="Box d-flex flex-items-center flex-justify-start p-2">
<img
className="avatar avatar-8"
src={`/logos/${name.toLowerCase()}.svg`}
/>
<div className="p-2">
<h2>{name}</h2>
<p>Download now</p>
</div>
</div>
</div>
</a>
))}
</div>
</div>
)}
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/(loggedIn)/team/sendInviteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function sendInviteForm({ teamName, userEmail }) {
<input
className="form-control "
type="email"
placeholder={`Teammate@${teamName?.name?.toLowerCase()}.com`}
placeholder={`Teammate@${teamName?.toLowerCase()}.com`}
aria-label="Teammate email"
/>
<button className="btn mx-2" type="submit" disabled={buttonDisabled}>
Expand Down
2 changes: 1 addition & 1 deletion app/(notLogged)/auth/verify/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function verify() {
</div>
</div>

<a href="https://github.com/apps/watermelon-context" target="_blank">
<a href="https://github.com/apps/watermelon-copilot-for-code-review" target="_blank">
<div
className="Box d-flex flex-items-center flex-justify-center flex-column p-4 p-4 m-2"
style={{ maxWidth: "80ch" }}
Expand Down
128 changes: 76 additions & 52 deletions app/api/actions/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { NextResponse } from "next/server";
import getAllServices from "../../../../utils/actions/getAllServices";
import randomText from "../../../../utils/actions/markdownHelpers/randomText";
import createTeamAndMatchUser from "../../../../utils/db/teams/createTeamAndMatchUser";
import sendUninstall from "../../../../utils/sendgrid/sendUninstall";



const app = new App({
appId: process.env.GITHUB_APP_ID!,
Expand All @@ -41,11 +44,11 @@ export async function POST(request: Request) {
try {
// Verify and parse the webhook event
const eventName = headers["x-github-event"];

let actionName = req.action;
if (
req.action === "opened" ||
req.action === "reopened" ||
req.action === "synchronize"
actionName === "opened" ||
actionName === "reopened" ||
actionName === "synchronize"
) {
const { missingParams } = validateParams(req, [
"pull_request",
Expand All @@ -65,6 +68,12 @@ export async function POST(request: Request) {

const octokit = await app.getInstallationOctokit(installationId);

if (pull_request.user.type === "Bot") {
return new Response("We don't comment on bot PRs", {
status: 400
});
}

let octoCommitList = await octokit.request(
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
{
Expand Down Expand Up @@ -92,6 +101,10 @@ export async function POST(request: Request) {
"as",
"at",
"better",
"bug",
"bugs",
"bugfix",
"bugfixes",
"build",
"bump dependencies",
"bump version",
Expand Down Expand Up @@ -337,7 +350,7 @@ export async function POST(request: Request) {

const count = await addActionCount({ owner });

textToWrite += `### WatermelonAI Summary \n`;
textToWrite += `### Watermelon AI Summary \n`;
let businessLogicSummary;
if (AISummary) {
businessLogicSummary = await getOpenAISummary({
Expand Down Expand Up @@ -413,48 +426,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 +489,9 @@ 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-copilot-for-code-review"
);
});
if (botComment?.id) {
// Update the existing comment
Expand Down Expand Up @@ -502,7 +524,7 @@ export async function POST(request: Request) {
repo,
owner,
number,
action: req.action,
action: actionName,
textToWrite,
},
});
Expand Down Expand Up @@ -535,7 +557,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-copilot-for-code-review");
});

// Update the existing comment
Expand All @@ -557,15 +579,15 @@ export async function POST(request: Request) {
repo,
owner,
number,
action: req.action,
action: actionName,
textToWrite,
},
});
return NextResponse.json({
message: "success",
textToWrite,
});
} else if (req.action === "created" || req.action === "edited") {
} else if (actionName === "created" || actionName === "edited") {
console.log("comment keys", Object.keys(req));
const { missingParams } = validateParams(req, [
"installation",
Expand All @@ -585,7 +607,7 @@ export async function POST(request: Request) {
const userLogin = comment.user.login;
let botComment = comment.body;
if (
userLogin === "watermelon-context[bot]" &&
userLogin === "watermelon-copilot-for-code-review[bot]" &&
botComment.includes("WatermelonAI Summary")
) {
// extract the business logic summary, it's always the first paragraph under the title
Expand Down Expand Up @@ -623,11 +645,13 @@ export async function POST(request: Request) {
repo,
owner,
number,
action: req.action,
action: actionName,
businessLogicSummary,
},
});
}
} else if (actionName === "deleted") {
sendUninstall({ emails: [req.sender.email] });
}
return NextResponse.json({
message: "wat",
Expand Down
2 changes: 1 addition & 1 deletion app/github-app/page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { redirect } from 'next/navigation';
export default async function GHApp({ params }) {
redirect('https://github.com/marketplace/watermelon-context');
redirect('https://github.com/marketplace/watermelon-copilot-for-code-review');
}
Loading
Loading