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

Allow bug action by anyone in org #41

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading