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

Commit

Permalink
Watermelon using app token (team tool) (#326)
Browse files Browse the repository at this point in the history
* Test using the installation id

* Add more logging

* Fix text to be clearer

* Extract pr labeling

* Fix missing params

* Remove logging

* Move log detection

* Restore order for labeling

* Add response with tracking

* Simplify code depth

* Add editing comment to triggers

* Remove unnecessary code

* Create createTeamAndMatchUser.ts

* Add team matching

* Remove github PAT fetching

* Test two branch option

* Make services suggest login

* Remove unused code

* Remove duplicate request object prop destructuring

* Fix TS error

* Fix TS error

---------

Co-authored-by: baristaGeek <estebanvargas94@gmail.com>
  • Loading branch information
EstebanDalelR and baristaGeek committed Oct 26, 2023
1 parent 7925771 commit 72b539f
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 125 deletions.
44 changes: 24 additions & 20 deletions app/api/actions/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export async function POST(request: Request) {
.slice(0, 6);
const serviceAnswers = await getAllServices({
userLogin,
installationId,
repo,
owner,
randomWords,
Expand All @@ -307,27 +308,30 @@ export async function POST(request: Request) {
});
}
if (!watermelon_user) {
{
// Post a new comment if no existing comment was found
await octokit
.request(
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
{
owner,
issue_number: number,
repo,
body: "[Please login to Watermelon to see the results](https://app.watermelontools.com/)",
}
)
.then((response) => {
console.info("post comment", response.data);
})
.catch((error) => {
return console.error("posting comment error", error);
});
return NextResponse.json("User not registered");
}
// Post a new comment if no existing comment was found
await octokit
.request(
"POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
{
owner,
issue_number: number,
repo,
body: "[Please login to GitHub in Watermelon to see the results](https://app.watermelontools.com/)",
}
)
.then((response) => {
console.info("post comment", response.data);
})
.catch((error) => {
return console.error("posting comment error", error);
});
return NextResponse.json("User not registered");
}
const team = await createTeamAndMatchUser({
name: organization.login,
id: organization.id,
watermelon_user,
});

const team = await createTeamAndMatchUser({
name: organization.login,
Expand Down
14 changes: 7 additions & 7 deletions app/api/extension/getContext/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export async function POST(request: Request) {
url: request.url,
email: req.email,
data: {
github: github?.fullData || github?.error,
jira: jira?.fullData || jira?.error,
confluence: confluence?.fullData || confluence?.error,
slack: slack?.fullData || slack?.error,
notion: notion?.fullData || notion?.error,
linear: linear?.fullData || linear?.error,
asana: asana?.fullData || asana?.error,
github: github?.error || github?.fullData,
jira: jira?.error || jira?.fullData,
confluence: confluence?.error || confluence?.fullData,
slack: slack?.error || slack?.fullData,
notion: notion?.error || notion?.fullData,
linear: linear?.error || linear?.fullData,
asana: asana?.error || asana?.fullData,
watermelonSummary: standardWatermelonAISummary,
},
});
Expand Down
Loading

0 comments on commit 72b539f

Please sign in to comment.