gh-event-api
GitHub Event API Server
What it does
@SpringBootApplication // You can make a regular Spring Boot application
public class Application {
public static void main(String... args) {
// This starts your app alongside gh-event-api
GHEventApiServer.start(Application.class, args);
}
@Bean // Declaring your handlers as Spring beans will bootstrap them
public PushHandler pushHandler() {
return payload -> {
System.out.println("got payload: " + payload);
};
}
@Bean // You can declare as many handlers as you want/need
public PushHandler anotherPushHandler() {
return payload -> {
System.out.println("got payload: " + payload);
};
}
}
After bootstrapping, the server listens for GitHub events at the configured port. (With sane defaults, courtesy of Spring Boot)
Configuration
Since eventually it's a Spring Boot app, all common application properties for the included version apply.
Examples
There are a few reference implementations of GitHub Event API style webhooks.
GitHub Review Window which is operational, right now mainly on this repository.
SpringIssueMaster which is a POC, based on the behavior of the Spring Issuemaster user.