diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java index 1e1dba5dd..6a0820c67 100644 --- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java +++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java @@ -33,6 +33,7 @@ import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; +import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; @@ -53,6 +54,9 @@ public class GhprbRepository implements Saveable { private static final transient EnumSet HOOK_EVENTS = EnumSet.of(GHEvent.ISSUE_COMMENT, GHEvent.PULL_REQUEST); + private static final List ALLOWED_ACTIONS = Arrays.asList("edited", "labeled", "opened", "reopened", "synchronize", + "unlabeled"); + private static final transient boolean INSECURE_WEBHOOKS = SystemProperties.getBoolean( GhprbRepository.class.getName() + ".webhook.insecure", false); @@ -393,7 +397,7 @@ void onPullRequestHook(PullRequest pr) throws IOException { doSave = true; } else if (!trigger.isActive()) { LOGGER.log(Level.FINE, "Not processing Pull request since the build is disabled"); - } else if ("edited".equals(action) || "opened".equals(action) || "reopened".equals(action) || "synchronize".equals(action)) { + } else if (ALLOWED_ACTIONS.contains(action)) { GhprbPullRequest pull = getPullRequest(ghpr, number); pull.check(ghpr, true); doSave = true;