@RequirePOST public FormValidation doRunTrigger(){
  FormValidation result;
  try {
    Jenkins instance=GitHubWebHook.getJenkinsInstance();
    if (instance.hasPermission(Item.BUILD)) {
      GitHubPRTrigger trigger=JobHelper.ghPRTriggerFromJob(job);
      if (trigger != null) {
        trigger.run();
        result=FormValidation.ok("GitHub PR trigger run");
        LOGGER.debug("GitHub PR trigger run for {}",job);
      }
 else {
        LOGGER.error("GitHub PR trigger not available for {}",job);
        result=FormValidation.error("GitHub PR trigger not available");
      }
    }
 else {
      LOGGER.warn("No permissions to run GitHub PR trigger");
      result=FormValidation.error("Forbidden");
    }
  }
 catch (  Exception e) {
    LOGGER.error("Can't run trigger",e);
    result=FormValidation.error(e,"Can't run trigger: %s",e.getMessage());
  }
  return result;
}

@ RequirePOST public FormValidation doRunTrigger ( ) { FormValidation result ; try { Jenkins instance = GitHubWebHook . getJenkinsInstance ( ) ; if ( instance . hasPermission ( Item . BUILD ) ) { GitHubPRTrigger trigger = JobHelper . ghPRTriggerFromJob ( job ) ; if ( trigger != null ) { trigger . run ( ) ; result = FormValidation . ok ( "GitHub PR trigger run" ) ; LOGGER . debug ( "GitHub PR trigger run for {}" , job ) ; } else { LOGGER . error ( "GitHub PR trigger not available for {}" , job ) ; result = FormValidation . error ( "GitHub PR trigger not available" ) ; } } else { LOGGER . warn ( "No permissions to run GitHub PR trigger" ) ; result = FormValidation . error ( "Forbidden" ) ; } } catch ( Exception e ) { LOGGER . error ( "Can't run trigger" , e ) ; result = FormValidation . error ( e , "Can't run trigger: %s" , e . getMessage ( ) ) ; } return result ; }
run trigger from web .
