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

Commit

Permalink
Extract count markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanDalelR committed Aug 1, 2023
1 parent 77c2efa commit 82508a2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions pages/api/actions/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,12 @@ export default async (req, res) => {
notionValue,
userLogin: pull_request.user.login,
});
if (repository.private) {
if (count.error) {
textToWrite += `\n We're sorry, we ran into an error${count.error}`;
} else {
textToWrite += `\n Your team ${count.name} has used Watermelon ${count.github_app_uses} times.`;
}
} else {
textToWrite += `\n ${repository.name} is an open repo and Watermelon will serve it for free.`;
textToWrite += `\n 🍉🫶`;
}
textToWrite += countMarkdown({
count,
isPrivateRepo: repository.private,
repoName: repo,
});

// Fetch all comments on the PR
const comments = await octokit.request(
"GET /repos/{owner}/{repo}/issues/{issue_number}/comments?sort=created&direction=desc",
Expand Down

0 comments on commit 82508a2

Please sign in to comment.