/*package*/ static Collection<String> toNames(Collection<GHLabel> labels) { List<String> r = new ArrayList<String>(); for (GHLabel l : labels) { r.add(l.getName()); } return r; } }
public void addLabels(Collection<GHLabel> labels) throws IOException { _addLabels(GHLabel.toNames(labels)); }
public GHLabel getLabel(String name) throws IOException { return root.retrieve().to(getApiTailUrl("labels/"+name), GHLabel.class).wrapUp(this); }
public GHLabel getLabel(String name) throws IOException { return root.retrieve().to(getApiTailUrl("labels/"+name), GHLabel.class).wrapUp(this); }
/*package*/ static Collection<String> toNames(Collection<GHLabel> labels) { List<String> r = new ArrayList<String>(); for (GHLabel l : labels) { r.add(l.getName()); } return r; } }
public GHLabel getLabel(String name) throws IOException { return root.retrieve().to(getApiTailUrl("labels/"+name), GHLabel.class).wrapUp(this); }
public void removeLabels(Collection<GHLabel> labels) throws IOException { _removeLabels(GHLabel.toNames(labels)); }
private void updateLabels(Collection<GHLabel> labels) { this.labels = new HashSet<>(); for (GHLabel label : labels) { this.labels.add(label.getName()); } }
public GHLabel createLabel(String name, String color) throws IOException { return root.retrieve().method("POST") .with("name",name) .with("color", color) .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this); }
public void removeLabels(Collection<GHLabel> labels) throws IOException { _removeLabels(GHLabel.toNames(labels)); }
public GHLabel createLabel(String name, String color) throws IOException { return root.retrieve().method("POST") .with("name",name) .with("color", color) .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this); }
public void addLabels(Collection<GHLabel> labels) throws IOException { _addLabels(GHLabel.toNames(labels)); }
public static boolean hasLabel(Collection<GHLabel> labels, String label) { if (labels != null) { for (GHLabel ghLabel : labels) { if (Objects.equal(label, ghLabel.getName())) { return true; } } } return false; }
public GHLabel createLabel(String name, String color) throws IOException { return root.retrieve().method("POST") .with("name",name) .with("color",color) .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this); }
public static boolean hasLabel(Collection<GHLabel> labels, String label) { if (labels != null) { for (GHLabel ghLabel : labels) { if (Objects.equal(label, ghLabel.getName())) { return true; } } } return false; }
private void _addLabels(Collection<String> names) throws IOException { List<String> newLabels = new ArrayList<String>(); for (GHLabel label : getLabels()) { newLabels.add(label.getName()); } for (String name : names) { if (!newLabels.contains(name)) { newLabels.add(name); } } setLabels(newLabels.toArray(new String[0])); }
/** * Returns issue label for release notes. * @param issue issue. * @return issue label for release notes * @throws IOException if an I/o error occurs. */ private static String getIssueLabelFrom(GHIssue issue) throws IOException { final Collection<GHLabel> issueLabels = issue.getLabels(); final Optional<GHLabel> label = issueLabels.stream() .filter(input -> Arrays.binarySearch(Constants.ISSUE_LABELS, input.getName()) >= 0) .findFirst(); return label.map(GHLabel::getName).orElse(""); } }
private void checkBlackListLabels() { Set<String> labelsToIgnore = helper.getBlackListLabels(); if (labelsToIgnore != null && !labelsToIgnore.isEmpty()) { try { for (GHLabel label : pr.getLabels()) { if (labelsToIgnore.contains(label.getName())) { LOGGER.log(Level.INFO, "Found label {0} in ignore list, pull request will be ignored.", label.getName()); shouldRun = false; } } } catch (Error e) { LOGGER.log(Level.SEVERE, "Failed to read blacklist labels", e); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to read blacklist labels", e); } } }