protected boolean applyNullSafe(@Nonnull GHHook hook) { return hook.getName().equals("jenkins") && hook.getConfig().get("jenkins_hook_url").equals(url.toExternalForm()); } };
protected boolean applyNullSafe(@Nonnull GHHook hook) { return hook.getName().equals("web") && hook.getConfig().get("url").equals(url.toExternalForm()); } };
/** * Verify if exists a webhook by its URL. */ private static boolean existsHook(GHOrganization org, String url) throws IOException { for (GHHook hook : org.getHooks()) { if (hook.getConfig().get("url").equals(url)) { return true; } } return false; }
private List<URL> getPostCommitHooks() { try { List<URL> r = new ArrayList<URL>(); for (GHHook h : getHooks()) { if (h.getName().equals("web")) { r.add(new URL(h.getConfig().get("url"))); } } return r; } catch (IOException e) { throw new GHException("Failed to retrieve post-commit hooks",e); } }
private List<URL> getPostCommitHooks() { try { List<URL> r = new ArrayList<URL>(); for (GHHook h : getHooks()) { if (h.getName().equals("web")) { r.add(new URL(h.getConfig().get("url"))); } } return r; } catch (IOException e) { throw new GHException("Failed to retrieve post-commit hooks",e); } }
private List<URL> getPostCommitHooks() { try { List<URL> r = new ArrayList<URL>(); for (GHHook h : getHooks()) { if (h.getName().equals("web")) { r.add(new URL(h.getConfig().get("url"))); } } return r; } catch (IOException e) { throw new GHException("Failed to retrieve post-commit hooks",e); } }
@Override public boolean remove(Object url) { try { String _url = ((URL)url).toExternalForm(); for (GHHook h : getHooks()) { if (h.getName().equals("web") && h.getConfig().get("url").equals(_url)) { h.delete(); return true; } } return false; } catch (IOException e) { throw new GHException("Failed to update post-commit hooks",e); } } };
@Override public boolean remove(Object url) { try { String _url = ((URL)url).toExternalForm(); for (GHHook h : getHooks()) { if (h.getName().equals("web") && h.getConfig().get("url").equals(_url)) { h.delete(); return true; } } return false; } catch (IOException e) { throw new GHException("Failed to update post-commit hooks",e); } } };
private boolean hookExist() throws IOException { GHRepository ghRepository = getGitHubRepo(); if (ghRepository == null) { throw new IOException("Unable to get repo [ " + reponame + " ]"); } for (GHHook h : ghRepository.getHooks()) { if (!"web".equals(h.getName())) { continue; } if (!getHookUrl().equals(h.getConfig().get("url"))) { continue; } return true; } return false; }
@Override public boolean remove(Object url) { try { String _url = ((URL)url).toExternalForm(); for (GHHook h : getHooks()) { if (h.getName().equals("web") && h.getConfig().get("url").equals(_url)) { h.delete(); return true; } } return false; } catch (IOException e) { throw new GHException("Failed to update post-commit hooks",e); } } };
private void removeExistingHook(final String callbackUrl) throws IOException { for (final GHHook hook : getRepository().getHooks()) { if (hook.isActive() && callbackUrl.equals(hook.getConfig().get("url"))) { hook.delete(); } } }
String url = rootUrl + "github-webhook/"; for (GHHook hook : org.getHooks()) { if (hook.getConfig().get("url").equals(url)) { hook.delete(); LOGGER.log(Level.INFO, "A webhook was deregistered for the organization {0}", org.getHtmlUrl());
boolean found = false; for (GHHook hook : org.getHooks()) { if (hook.getConfig().get("url").equals(url)) { found = !hook.getEvents().containsAll(EVENTS); break;