diff --git a/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueLabelGHEventSubscriber.java b/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueLabelGHEventSubscriber.java index b7402e6..d73940f 100644 --- a/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueLabelGHEventSubscriber.java +++ b/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueLabelGHEventSubscriber.java @@ -147,6 +147,9 @@ protected void onEvent(GHEvent event, String payload) { Pattern pattern = Pattern.compile(expectedLabel, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); if (pattern.matcher(label).matches()) { + if (!GithubHelper.isAuthorized(job, labellingAuthor, branchProp.getMinimumPermissions())) { + continue; + } if (alreadyTriggeredJobs.add(job)) { ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new GitHubPullRequestLabelCause( diff --git a/src/main/java/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty.java b/src/main/java/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty.java index 3deac3b..a7ecd95 100644 --- a/src/main/java/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty.java +++ b/src/main/java/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty.java @@ -3,7 +3,6 @@ import hudson.Extension; import hudson.model.Job; import hudson.model.Run; -import jenkins.branch.BranchProperty; import jenkins.branch.BranchPropertyDescriptor; import jenkins.branch.JobDecorator; import org.kohsuke.stapler.DataBoundConstructor; @@ -11,7 +10,7 @@ /** * Allows a GitHub pull request comment to trigger an immediate build based on a comment string. */ -public class TriggerPRLabelBranchProperty extends BranchProperty { +public class TriggerPRLabelBranchProperty extends TriggerBranchProperty { /** * The comment body to trigger a new build on. */ diff --git a/src/main/resources/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty/config.jelly b/src/main/resources/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty/config.jelly index 7742119..804e0cf 100644 --- a/src/main/resources/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty/config.jelly +++ b/src/main/resources/com/adobe/jenkins/github_pr_comment_build/TriggerPRLabelBranchProperty/config.jelly @@ -5,4 +5,7 @@ + + +