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

Bugfix: Count github app usage by owner instead of watermelon_user #313

Merged
merged 2 commits into from
Sep 27, 2023

Conversation

baristaGeek
Copy link
Collaborator

Description

The goal of this PR is to differentiate Watermelon's usage on a personal vs an organizational repo in terms of counting usage.

Previously we measured by watermelon_user with a query that retrieved the UserTeam this watermelon_user is part of and then increasing the count to that UserTeam. The problem with this is that it doesn't differentiate between personal and organizational usge. We know that people like testing this tool (as similar tools) on personal repos before taking them to their organizational repos. Therefore it's important to make such diferentiation.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Chore: cleanup/renaming, etc
  • RFC

Notes

The old stored procedure, increment github_app_uses , hasn't been deleted

Acceptance

…uses) passing the owner instead of the watermelon_user as the parameter to increase the count by
@vercel
Copy link

vercel bot commented Sep 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
watermelon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2023 9:47pm

@watermelon-copilot-for-code-review
Copy link

watermelon-copilot-for-code-review bot commented Sep 26, 2023

WatermelonAI Summary

The two commits in this Pull Request focus on updating the logic for counting Watermelon's usage on personal and organizational repos. The first commit creates and calls a new stored procedure that takes the owner of the repo as a parameter, instead of the watermelon user. This change allows for differentiating between personal and organizational usage. The second commit merges the development branch into the bugfix/user-or-org-to-gh-app branch. The PR aims to fix the bug by counting the github app usage by owner instead of the watermelon user.

GitHub PRs

Click here to login to Jira
Click here to login to Confluence
Click here to login to Slack
Notion Pages deactivated by baristaGeek
Linear Tickets deactivated by baristaGeek
Click here to login to Asana
watermelon is an open repo and Watermelon will serve it for free.
🍉🫶

let query = await executeRequest(
`EXEC dbo.increment_github_app_uses @watermelon_user = '${watermelon_user}'`
`EXEC dbo.increment_owner_github_app_uses @watermelon_user = '${owner}'`
Copy link
Member

Choose a reason for hiding this comment

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

How does this work for forks?

Copy link
Member

Choose a reason for hiding this comment

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

For example, in this repo, people need to fork it to open a PR, but when the PR is run it will count against the "watermelontools" owner, not the contributor one, and we'll miss the chance of adding a new user.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

First of all, we don't limit open-source usage so if people are forking a repo of such kind it doesn't matter.

But even if we did, or in the future we decide that we want to do so, we can choose not to add to the count if the repo is a fork. Octokit allows us to determine if a repo is a fork or not via various methods. One of them could be calling octokit.rest.repos.get and checking if the parent and source props exist for that repo

Copy link
Member

Choose a reason for hiding this comment

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

Stamp.

let query = await executeRequest(
`EXEC dbo.increment_github_app_uses @watermelon_user = '${watermelon_user}'`
`EXEC dbo.increment_owner_github_app_uses @watermelon_user = '${owner}'`
Copy link
Member

Choose a reason for hiding this comment

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

Stamp.

@baristaGeek baristaGeek merged commit a6b47ba into dev Sep 27, 2023
2 checks passed
@baristaGeek baristaGeek deleted the bugfix/user-or-org-to-gh-app branch September 27, 2023 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants