Calls {@link GitHubPushTrigger} in all projects to handle this hook

@param event   only PUSH event
974710
@Override
    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());
        final GitHubRepositoryName changedRepository = GitHubRepositoryName.create(repoUrl.toExternalForm());

        if (changedRepository != null) {
            // run in high privilege to see all the projects anonymous users don't see.
            // this is safe because when we actually schedule a build, it's a build that can
            // happen at some random time anyway.
            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);
        }
    }
1359585
public <E extends Event> void publish(E event) {
        if (!eventListenerMap.isEmpty()) {
            EventListener<E> eventListener = getEventListener(event);
            if (eventListener != null) {
                eventListener.on(event);
            }
        }
    }
1016095
public void trigger(Object event){

        Set<Class> eventTypes = getAllInheritedClasses(event.getClass());

        for (Class eventType : eventTypes) {
            if(observers.containsKey(eventType)){
                for (EventObserver eventObserver : observers.get(eventType)) {
                    executionQueue.get().add(new EventExecution(event, eventObserver));
                }
            }
        }

        triggerQueue();
    }
443165
public ProjectHook modifyHook(ProjectHook hook) throws GitLabApiException {

        GitLabApiForm formData = new GitLabApiForm()
            .withParam("url", hook.getUrl(), true)
            .withParam("push_events", hook.getPushEvents(), false)
            .withParam("issues_events", hook.getIssuesEvents(), false)
            .withParam("merge_requests_events", hook.getMergeRequestsEvents(), false)
            .withParam("tag_push_events", hook.getTagPushEvents(), false)
            .withParam("note_events", hook.getNoteEvents(), false)
            .withParam("job_events", hook.getJobEvents(), false)
            .withParam("pipeline_events", hook.getPipelineEvents(), false)
            .withParam("wiki_events", hook.getWikiPageEvents(), false)
            .withParam("enable_ssl_verification", hook.getEnableSslVerification(), false)
            .withParam("token", hook.getToken(), false);

        Response response = put(Response.Status.OK, formData.asMap(), "projects", hook.getProjectId(), "hooks", hook.getId());
        return (response.readEntity(ProjectHook.class));
    }
835732
public void fireEvent(SystemHookEvent event) throws GitLabApiException {

        if (event instanceof ProjectSystemHookEvent) {
            fireProjectEvent((ProjectSystemHookEvent) event);
        } else if (event instanceof TeamMemberSystemHookEvent) {
            fireTeamMemberEvent((TeamMemberSystemHookEvent) event);
        } else if (event instanceof UserSystemHookEvent) {
            fireUserEvent((UserSystemHookEvent) event);
        } else if (event instanceof KeySystemHookEvent) {
            fireKeyEvent((KeySystemHookEvent) event);
        } else if (event instanceof GroupSystemHookEvent) {
            fireGroupEvent((GroupSystemHookEvent) event);
        } else if (event instanceof GroupMemberSystemHookEvent) {
            fireGroupMemberEvent((GroupMemberSystemHookEvent) event);
        } else if (event instanceof PushSystemHookEvent) {
            firePushEvent((PushSystemHookEvent) event);
        } else if (event instanceof TagPushSystemHookEvent) {
            fireTagPushEvent((TagPushSystemHookEvent) event);
        } else if (event instanceof RepositorySystemHookEvent) {
            fireRepositoryEvent((RepositorySystemHookEvent) event);
        } else if (event instanceof MergeRequestSystemHookEvent) {
            fireMergeRequestEvent((MergeRequestSystemHookEvent) event);
        } else {
            String message = "Unsupported event, event_named=" + event.getEventName();
            LOGGER.warning(message);
            throw new GitLabApiException(message);
        }
    }
993503
public void handleEvent(Event event) throws GitLabApiException {

        LOGGER.info("handleEvent: object_kind=" + event.getObjectKind());

        switch (event.getObjectKind()) {
        case BuildEvent.OBJECT_KIND:
        case IssueEvent.OBJECT_KIND:
        case MergeRequestEvent.OBJECT_KIND:
        case NoteEvent.OBJECT_KIND:
        case PipelineEvent.OBJECT_KIND:
        case PushEvent.OBJECT_KIND:
        case TagPushEvent.OBJECT_KIND:
        case WikiPageEvent.OBJECT_KIND:
            break;

        default:
            String message = "Unsupported event object_kind, object_kind=" + event.getObjectKind();
            LOGGER.warning(message);
            throw new GitLabApiException(message);
        }

        fireEvent(event);
    }
379589
private void hookToTrigger(final T trigger) {
        // Hook to trigger only if not already done (the same trigger adatper will be used if it was already hooked)
        if (!triggersToTriggerAdapters.containsKey(trigger)) {
            final TriggerListener triggerAdapter = new TriggerAdapter(trigger);
            triggersToTriggerAdapters.put(trigger, triggerAdapter);
            trigger.addTriggerListener(triggerAdapter);
        }
    }
65739
@SuppressWarnings("unused")
    @RequirePostWithGHHookPayload
    public void doIndex(@Nonnull @GHEventHeader GHEvent event, @Nonnull @GHEventPayload String payload) {
        GHSubscriberEvent subscriberEvent =
                new GHSubscriberEvent(SCMEvent.originOf(Stapler.getCurrentRequest()), event, payload);
        from(GHEventsSubscriber.all())
                .filter(isInterestedIn(event))
                .transform(processEvent(subscriberEvent)).toList();
    }
815383
function onEvent(event) {
    if (event.eventType == nuimotion.Events.GESTURE) {
        console.log("Gesture: " + event.gestureType + " Hand: " + event.hand + " State: " + event.step);
    } else {
        console.log("Event: " + event.eventType);
    }
    for (var c in connections) {
        connections[c].sendUTF(JSON.stringify(event));
    }
}
483979
function(event, fn) {
        // Get handle to event, creating it if necessary
        var callbacks = this._callbacks[event];
        if (!callbacks) {
            callbacks = this._callbacks[event] = (handlers[event] ||
                (handlers[event] = {}))[this[0]] = [];
            callbacks.context = this;
            callbacks.depth = 0;
        }
        // Push to callback array
        callbacks.push(fn);
    }
493208
@FunctionName("EventHubTriggerJava")
    public void run(
            @EventHubTrigger(name = "message", eventHubName = "trigger", connection = "CIEventHubConnection", consumerGroup = "$Default") String message,
            @EventHubOutput(name = "result", eventHubName = "output", connection = "CIEventHubConnection" ) OutputBinding<String> result,
            final ExecutionContext context
    ) {
        if(message.contains("CIInput")){
            result.setValue("CITest");
        }
    }
718852
@SuppressWarnings("incomplete-switch")
    public void onPipeConnectionEvent(PipeConnectionEvent event) {
        switch (event.getType()) {
            case CONSUMER_CONNECT_PUSH:
                if (event.getConsumer() == this) {
                    Map<String, Object> paramMap = event.getParamMap();
                    if (paramMap != null) {
                        mode = (String) paramMap.get("mode");
                    }
                }
                break;
        }
    }
1086795
def run(self, event):
        
        repo_id = event.payload['repository']['id']

        # Ping event - update the ping timestamp of the repository
        if 'hook_id' in event.payload and 'zen' in event.payload:
            repository = Repository.query.filter_by(
                github_id=repo_id
            ).one()
            repository.ping = datetime.utcnow()
            db.session.commit()
            return

        # Release event
        if 'release' in event.payload and \
                event.payload.get('action') == 'published':
            try:
                release = Release.create(event)
                db.session.commit()

                # FIXME: If we want to skip the processing, we should do it
                # here (eg. We're in the middle of a migration).
                # if current_app.config['GITHUB_PROCESS_RELEASES']:
                process_release.delay(
                    release.release_id,
                    verify_sender=self.verify_sender
                )
            except (ReleaseAlreadyReceivedError, RepositoryDisabledError) as e:
                event.response_code = 409
                event.response = dict(message=str(e), status=409)
            except RepositoryAccessError as e:
                event.response = 403
                event.response = dict(message=str(e), status=403)
1297859
@SuppressWarnings({"unused", "WeakerAccess"})
    public void pushEvent(String eventName) {
        if (eventName == null || eventName.trim().equals(""))
            return;

        pushEvent(eventName, null);
    }
747022
public static function postHooks(Event $event): bool
    {
        $directory = self::getProjectDir($event);

        if (!file_exists($directory . '.git')) {
            throw new Exception(sprintf('Oops! Local Git repository not found.'));
        }

        $io = $event->getIO();

        foreach (self::$hooks as $hookName) {
            $hook     = sprintf(
                '%1$s.git%3$shooks%3$s%2$s',
                $directory,
                $hookName,
                DIRECTORY_SEPARATOR
            );
            $original = sprintf(
                '%1$s%3$s..%3$shooks%3$s%2$s',
                __DIR__,
                $hookName,
                DIRECTORY_SEPARATOR
            );

            copy($original, $hook);
            chmod($hook, 0777);
        }

        $io->write('<info>Hooks added!</info>');

        return true;
    }
718053
private synchronized void pushEvent(Event event, boolean flushBuffer)
  {
    eventBuffer.add(event);

    if (flushBuffer || eventBuffer.size() >= maxEntries)
    {
      this.flushEventBuffer();
    }
  }
1297686
protected void fireTriggerEvent(TriggerEvent event) {
        try {
            for (TriggerListener listener : listeners) {
                listener.triggerValidation(event);
            }
        } catch (RuntimeException e) {
            uncheckedExceptionHandler.handleException(e);
        } catch (Error e) {
            uncheckedExceptionHandler.handleError(e);
        }
    }