Source:
protected void onEvent(final GHSubscriberEvent event) { GHEventPayload.Push push; try { push = GitHub.offline().parseEventPayload(new StringReader(event.getPayload()), GHEventPayload.Push.class); } catch (IOException e) { LOGGER.warn("Received malformed PushEvent: " + event.getPayload(), e); return; } URL repoUrl = push.getRepository().getUrl(); final String pusherName = push.getPusher().getName(); LOGGER.info("Received PushEvent for from {}", repoUrl, event.getOrigin()); GitHubRepositoryName fromEventRepository = GitHubRepositoryName.create(repoUrl.toExternalForm()); if (fromEventRepository == null) { URL htmlUrl = push.getRepository().getHtmlUrl(); fromEventRepository = GitHubRepositoryName.create(htmlUrl.toExternalForm()); if (fromEventRepository != null) { LOGGER.info("PushEvent handling: 'html_url' field " + "has been used to retrieve project information (instead of default 'url' field)"); } } final GitHubRepositoryName changedRepository = fromEventRepository; if (changedRepository != null) { ACL.impersonate(ACL.SYSTEM, new Runnable() { @Override public void run() { for (Item job : Jenkins.getInstance().getAllItems(Item.class)) { GitHubPushTrigger trigger = triggerFrom(job, GitHubPushTrigger.class); if (trigger != null) { String fullDisplayName = job.getFullDisplayName(); LOGGER.debug("Considering to poke {}", fullDisplayName); if (GitHubRepositoryNameContributor.parseAssociatedNames(job) .contains(changedRepository)) { LOGGER.info("Poked {}", fullDisplayName); trigger.onPost(GitHubTriggerEvent.create() .withTimestamp(event.getTimestamp()) .withOrigin(event.getOrigin()) .withTriggeredByUser(pusherName) .build() ); } else { LOGGER.debug("Skipped because it doesn't have a matching repository.", fullDisplayName); } } } } }); for (GitHubWebHook.Listener listener : ExtensionList.lookup(GitHubWebHook.Listener.class)) { listener.onPushRepositoryChanged(pusherName, changedRepository); } } else { LOGGER.warn("Malformed repo url {}", repoUrl); } }

Target:
protected void onEvent(final GHSubscriberEvent event) { GHEventPayload.Push push; try { push = GitHub.offline().parseEventPayload(new StringReader(event.getPayload()), GHEventPayload.Push.class); } catch (IOException e) { LOGGER.warn("Received malformed PushEvent: " + event.getPayload(), e); return; } URL repoUrl = push.getRepository().getUrl(); final String pusherName = push.getPusher().getName(); LOGGER.info("Received PushEvent for from {}", repoUrl, event.getOrigin()); GitHubRepositoryName fromEventRepository = GitHubRepositoryName.create(repoUrl.toExternalForm()); if (fromEventRepository == null) { URL htmlUrl = push.getRepository().getHtmlUrl(); fromEventRepository = GitHubRepositoryName.create(htmlUrl.toExternalForm()); if (fromEventRepository != null) { LOGGER.debug("PushEvent handling: 'html_url' field " + "has been used to retrieve project information (instead of default 'url' field)"); } } final GitHubRepositoryName changedRepository = fromEventRepository; if (changedRepository != null) { ACL.impersonate(ACL.SYSTEM, new Runnable() { @Override public void run() { for (Item job : Jenkins.getInstance().getAllItems(Item.class)) { GitHubPushTrigger trigger = triggerFrom(job, GitHubPushTrigger.class); if (trigger != null) { String fullDisplayName = job.getFullDisplayName(); LOGGER.debug("Considering to poke {}", fullDisplayName); if (GitHubRepositoryNameContributor.parseAssociatedNames(job) .contains(changedRepository)) { LOGGER.info("Poked {}", fullDisplayName); trigger.onPost(GitHubTriggerEvent.create() .withTimestamp(event.getTimestamp()) .withOrigin(event.getOrigin()) .withTriggeredByUser(pusherName) .build() ); } else { LOGGER.debug("Skipped because it doesn't have a matching repository.", fullDisplayName); } } } } }); for (GitHubWebHook.Listener listener : ExtensionList.lookup(GitHubWebHook.Listener.class)) { listener.onPushRepositoryChanged(pusherName, changedRepository); } } else { LOGGER.warn("Malformed repo url {}", repoUrl); } }