Skip to content

Commit

Permalink
improved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RajuGangitla committed Oct 11, 2024
1 parent a4ef133 commit 2a8ddf2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const ASSIGN_IDENTIFIER = "/assign" as const;
export const CREATE_IDENTIFIER = "/oss.gg" as const;
export const UNASSIGN_IDENTIFIER = "/unassign" as const;
export const REJECT_IDENTIFIER = "/reject" as const;
export const PLAYER_SUBMISSION = "player submission" as const;
export enum EVENT_TRIGGERS {
ISSUE_OPENED = "issues.opened",
INSTALLATION_CREATED = "installation.created",
Expand Down
37 changes: 36 additions & 1 deletion lib/github/hooks/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ON_NEW_ISSUE,
ON_USER_NOT_REGISTERED,
OSS_GG_LABEL,
PLAYER_SUBMISSION,
POINT_IS_NOT_A_NUMBER,
REJECTION_MESSAGE_TEMPLATE,
REJECT_IDENTIFIER,
Expand Down Expand Up @@ -81,11 +82,20 @@ export const onAssignCommented = async (webhooks: Webhooks) => {
const installationId = context.payload.installation?.id!;
const octokit = getOctokitInstance(installationId);
const isOssGgLabel = context.payload.issue.labels.some((label) => label.name === OSS_GG_LABEL);
const isPlayerSubmission = context.payload.issue.labels.some((label) => label.name === PLAYER_SUBMISSION);

// Check if this is a pull request
const isPullRequest = !!context.payload.issue.pull_request;
if (issueCommentBody.trim() === ASSIGN_IDENTIFIER) {
if (!isOssGgLabel) return;
if (!isOssGgLabel) {
await octokit.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: "This issue is not part of oss.gg hackathon. Please pick a different one or start with a side quest (https://oss.gg/side-quests)",
});
return;
}

// If it's a pull request, don't allow assignment
if (isPullRequest) {
Expand All @@ -98,6 +108,31 @@ export const onAssignCommented = async (webhooks: Webhooks) => {
return;
}

//If issue has a label player submission
if (isPlayerSubmission) {
const comment = ` This is a submission of a different player for a side quest, you cannot get assigned to that.
If you also want to complete it, here is the list of all side quests (link to oss.gg/side-quests)
If you want to make e.g. 1050 points in 5 minutes without touching code, do the Starry-eyed Supporter quest (link to https://formbricks.notion.site/How-to-make-1050-points-without-touching-code-in-5-minutes-e71e624b5b9b487bbac28030d142438a?pvs=74 )
As a reminder, this is how side quest submissions work:
1. Complete the quest, gather proof (as described above)
2. Open a oss.gg submission issue in the respective repository
3. Wait for a maintainer to review, award points and close the issue
4. In the meanwhile, you can work on all other side quests :rocket:
Thanks for playing! OPEN SOURCE LETS GOOOO! `
await octokit.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: comment,
});
return;
}

const isAssigned = context.payload.issue.assignees.length > 0;
if (isAssigned) {
const assignee = context.payload.issue.assignees[0].login;
Expand Down

0 comments on commit 2a8ddf2

Please sign in to comment.