Years ago, I worked for SensioLabs, the company behind the so famous PHP framework Symfony. During the Symfony Live, Fabien Potencier introduced fabbot.io to the community.

Fabbot.io is a tool to track the most common errors done by contributors that block the contribution for mostly nothing. To be honest, I was really amazed how useful this tool can be, even if I wanted this tool to do much more.

Features provided by fabbot.io

Sadly Fabien does not plan to open source it, yet.

When you think about a contribution on GitHub, regardless this is an open source or proprietary project, the process from the first line of code to the release is the same.

If you want to ease the process, you need to identify every step that can block the contribution (and/or the contributor itself) to be accepted, merged and released to the community.

So I wanted to do my own tool to help both maintainers and contributors, but I didn’t know how to do it. Years passed and I managed to make my own bot, I even made several. I have to say that in fact it’s really easy and I feel ashamed of not have been able to do it a few years ago!

GitHub is both a social network for developers and a hosting platform for git projects. Every time an action is done on your project, GitHub creates a dedicated event and allow you to listen to theses events.

For instance, let’s say someone made an issue on your repository to ask for a bug fix, how can you get the information?

This is really simple, thanks to the web hooks!

A web hook catches events dispatched by GitHub, the Payload URL is the very first endpoint of your bot to listen events.

Webhook from GitHub, pull request was labeled

Every event is very well documented by GitHub and will be pushed as a POST JSON response to the provided Payload url (this url must be accessible from the outside).

The first step to make a bot is to be able to get these events and retrieve human-readable information about what happens in your project.

To convert the JSON object returned and simplify treatment of the information, you can use the GitHub event parser library I have created for:

Minimal GitHub bot implementation

With this “bot”, every time an action is done on your GitHub project a POST response is sent to your script. The resolver is able to return human-readable information that you can store in the database for instance.

This first article is now done, thanks for reading!

In the next article, I’ll explain how to interact with GitHub using the REST API. We will learn how to create comments, how to establish labeling an issue or even close a pull request!