Skip to content

Commit

Permalink
Merge pull request #138 from formbricks/fix-pr-assignment
Browse files Browse the repository at this point in the history
fix: pr assignment
  • Loading branch information
mattinannt authored Oct 11, 2024
2 parents b204365 + c384352 commit bd3c434
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/github/hooks/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,23 @@ export const onAssignCommented = async (webhooks: Webhooks) => {
const octokit = getOctokitInstance(installationId);
const isOssGgLabel = context.payload.issue.labels.some((label) => label.name === OSS_GG_LABEL);

// Check if this is a pull request
const isPullRequest = !!context.payload.issue.pull_request;

if (issueCommentBody.trim() === ASSIGN_IDENTIFIER) {
if (!isOssGgLabel) return;

// If it's a pull request, don't allow assignment
if (isPullRequest) {
await octokit.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: "The /assign command can only be used on issues, not on pull requests.",
});
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 bd3c434

Please sign in to comment.