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

Commit

Permalink
Add non-registered user response
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanDalelR committed Jun 20, 2023
1 parent fb1c968 commit cea4891
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pages/api/actions/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ export default async (req, res) => {
user_email,
watermelon_user,
} = wmUserData;
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.log("post comment", response.data);
})
.catch((error) => {
return console.error("posting comment error", error);
});
return res.status(401).send("User not registered");
}
}
let octoCommitList = await octokit.request(
"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
{
Expand All @@ -78,7 +100,6 @@ export default async (req, res) => {
}
);
let commitList: string[] = [];

for (let index = 0; index < octoCommitList?.data?.length; index++) {
commitList.push(octoCommitList.data[index].commit.message);
}
Expand Down

1 comment on commit cea4891

@vercel
Copy link

@vercel vercel bot commented on cea4891 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.