Skip to content

Commit

Permalink
Allow bug action by anyone in org (#41)
Browse files Browse the repository at this point in the history
Closes #40

Signed-off-by: stianst <stianst@gmail.com>
  • Loading branch information
stianst authored Feb 29, 2024
1 parent 2b4e06d commit 070d3ad
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main/java/org/keycloak/gh/bot/BugActionsOnComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.keycloak.gh.bot.labels.Kind;
import org.keycloak.gh.bot.utils.Labels;
import org.kohsuke.github.GHEventPayload;
import org.kohsuke.github.GHLabel;
import org.kohsuke.github.GHPermissionType;

import java.io.IOException;

Expand All @@ -16,12 +14,10 @@ public class BugActionsOnComment {
@Inject
BugActions bugActions;

void onLabeled(@IssueComment.Created GHEventPayload.IssueComment payload) throws IOException {
void onCommentCreated(@IssueComment.Created GHEventPayload.IssueComment payload) throws IOException {
if (Labels.hasLabel(payload.getIssue(), Kind.BUG.toLabel())) {
Action action = getAction(payload.getComment().getBody());

GHPermissionType permission = payload.getRepository().getPermission(payload.getSender());
if (GHPermissionType.WRITE.equals(permission) || GHPermissionType.ADMIN.equals(permission)) {
if (payload.getSender().isMemberOf(payload.getOrganization())) {
bugActions.runAction(action, payload.getIssue());
}
}
Expand Down

0 comments on commit 070d3ad

Please sign in to comment.