Back to Blog

Merge GitHub Pull Requests with Authy OneTouch

2016-12-04_2248
Adding a security layer to merge pull requests is easy to implement using cloud platforms like Authy. In just a few hours I was able to set up the entire process, and thought that perhaps I could help you shave some time off your workload by showing you how.

As you know, GitHub has a well-documented API, and I used their webhooks to trigger pull requests events. The pull requests are received by an external app built to create Authy OneTouch transactions, and after a user approves these transactions this app uses the GitHub API to merge the pull requests. The workflow is better explained in the next image.

githubauthy

 

Below is a demo app merging a pull request with Authy OneTouch:

cesar

 

You can find the demo app at https://github.com/cepinos/merge-pull-requests-with-authy-onetouch. Feel free to clone or fork this.

To create the webhook in Authy, go to Settings, and add the url for the OneTouch approves. This will call the app to approve or deny the merge:

mergepic

 

How to create the Webhooks:

The path to create the webhooks in GitHub is at YOURREPO > settings > Webhooks & Services. Add a new webhook and configure it to trigger pull requests events:

2016-03-17_1035

The webhook that receives the pull requests created saves the JSON object sent by GitHub. This controller is also in charge of creating the OneTouch transaction:

2016-03-17_1036

After a transaction is approved, Authy triggers a webhook to merge the pull request.

2016-03-17_1037

By adding multiple approves from admins before merge a pull request, this app can be used to add a security layer in your repositories. Please let me know how this process works for you and/or if you have any questions. I can be reached at [email protected].

 

 

 

About the author Cesar Pino

Cesar Pino, Software Engineer – JavaScript at Twilio, works with he Authy Team in Bogotá, Colombia. He is the founder of expedientes.co, an application to look for people mentioned in legal matters. His favorite stack is AngularJS/Python/Django/Postgres for Backend and he uses Agile and TDD to develop apps. He likes to learn about technology and is always improving his developments skills.

We can text you a link to get started:

Close