Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: If a PR has oss.gg and points assigned as labels, it should auto award on merge #102

Merged
merged 6 commits into from
Sep 20, 2024

Conversation

RajuGangitla
Copy link
Contributor

What does this PR do?

If a PR has oss.gg and points assigned as labels, it should auto award on merge

Fixes #86

screen-capture.21.mp4

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at oss.gg
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Sep 13, 2024

@RajuGangitla is attempting to deploy a commit to the formbricks Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request 💸 5 USD 🕹️ 250 points 🕹️ oss.gg labels Sep 13, 2024
Copy link

github-actions bot commented Sep 13, 2024

Thank you for following the naming conventions for pull request titles! 🙏

}

const octokit = getOctokitInstance(context.payload.installation?.id!);

Copy link
Member

Choose a reason for hiding this comment

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

let's first check if the PR itself has a points label and if so, award the points. If not, go and search in linked issues.

Copy link
Member

Choose a reason for hiding this comment

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

make sure to not repeat the code for awarding points (and if the user isn't found creating one).

we already have that functionality in the /award function. You might have to move it to the utils.ts in the /github folder and then refactor both the onAwardPoints and your new function

continue; // Skip this issue and move to the next one
}

// Extract points from labels like "🕹️ 50 points", "🕹️ 100 points", etc.
Copy link
Member

Choose a reason for hiding this comment

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

we have a extractPointsFromLabel helper function in github/utils - please use this


// Fetch or create user profile only if the oss.gg label is present
let user = await getUserByGithubId(prAuthorGithubId);
if (!user) {
Copy link
Member

Choose a reason for hiding this comment

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

as mentioned above, please create a helper function and refactor onAwardPoints to use it

"Awarded points",
pullRequest.html_url,
ossGgRepo?.id
);
Copy link
Member

Choose a reason for hiding this comment

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

after the points are awarded, we want to add the same comment to the PR we issue on onAwardPoints. Here, also make sure to follow the DRY coding principle.

@RajuGangitla
Copy link
Contributor Author

@jobenjada pushed the latest changes

@jobenjada
Copy link
Member

code looks good, will test and merge likely on the weekend as I'm not sure if I have time before hand 🙌

Copy link
Member

@jobenjada jobenjada left a comment

Choose a reason for hiding this comment

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

LGTM

@jobenjada jobenjada added this pull request to the merge queue Sep 20, 2024
Merged via the queue into formbricks:main with commit a8ab4df Sep 20, 2024
2 of 3 checks passed
@jobenjada
Copy link
Member

/award 250

Copy link

oss-gg bot commented Sep 20, 2024

Awarding RajuGangitla: 250 points! Check out your new contribution on oss.gg/RajuGangitla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request 🕹️ oss.gg 💸 5 USD 🕹️ 250 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] If a PR has oss.gg and points assigned as labels, it should auto award on merge
2 participants