-
Notifications
You must be signed in to change notification settings - Fork 46
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
Conversation
@RajuGangitla is attempting to deploy a commit to the formbricks Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions for pull request titles! 🙏 |
} | ||
|
||
const octokit = getOctokitInstance(context.payload.installation?.id!); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
lib/github/hooks/issue.ts
Outdated
continue; // Skip this issue and move to the next one | ||
} | ||
|
||
// Extract points from labels like "🕹️ 50 points", "🕹️ 100 points", etc. |
There was a problem hiding this comment.
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
lib/github/hooks/issue.ts
Outdated
|
||
// Fetch or create user profile only if the oss.gg label is present | ||
let user = await getUserByGithubId(prAuthorGithubId); | ||
if (!user) { |
There was a problem hiding this comment.
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
lib/github/hooks/issue.ts
Outdated
"Awarded points", | ||
pullRequest.html_url, | ||
ossGgRepo?.id | ||
); |
There was a problem hiding this comment.
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.
@jobenjada pushed the latest changes |
code looks good, will test and merge likely on the weekend as I'm not sure if I have time before hand 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/award 250 |
Awarding RajuGangitla: 250 points! Check out your new contribution on oss.gg/RajuGangitla |
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
pnpm build
console.logs
git pull origin main
Appreciated