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

Handle (un)labeled pull request hooks (remake) #804

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -53,6 +54,9 @@ public class GhprbRepository implements Saveable {

private static final transient EnumSet<GHEvent> HOOK_EVENTS = EnumSet.of(GHEvent.ISSUE_COMMENT, GHEvent.PULL_REQUEST);

private static final List<String> 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);

Expand Down Expand Up @@ -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;
Expand Down