This is a demo of Haiku, a platform that creates Heroku applications on-demand from pull requests in your GitHub repository. The idea is that every time you create a new pull request, the state of the branch you're about to merge is used to create and build a new Heroku application, which will give you a unique URL that can be used to test the new state, or to share a feature with a colleague or client.
To show you how it works, I'll make some changes to my site, which is running Jekyll on GitHub Pages. I'm changing the global colour scheme by inverting these two variables in Sass, so we have white text on a black background.
I’ll create a new branch from master
, which I’ll call haiku-demo
. I’m adding the file I’ve changed, committing and finally pushing to the remote.
Now, I’ll create a pull request from haiku-demo
to master
. As you can see, a new status has been added to the pull request, telling me that Haiku is building a new application.
The time this takes to complete will depend on the project being built, but when it finishes you’ll see a status update informing you that the application is ready to use. Click on Details to open it. As you can see, this URL gives me a snapshot of my site with the changes I’m proposing to merge.
I’m now going back to my code and do some more changes. In this case, I’m going to revert the colours to the value they had originally. I’ll then follow the same process of committing and pushing the changes to the same branch I’ve used before.
If I go back to the pull request and refresh the page, you can see that Haiku has picked up the new commit and will rebuild the application. It’ll use the same URL, since we’re making changes to an existing pull request. If I refresh, we’ll see the Heroku application updated with the latest changes. Once you merge or close the pull request, the Heroku app has served its purpose, so Haiku will get rid of it.
To start using it, you need to deploy Haiku to a location of your choice, which can itself be on Heroku. Next, you need to connect it to your repository, using a webhook. In the Settings page, add a new webhook and provide the URL of your Haiku app, set the content type to JSON, choose a secret and select the individual events you want to broadcast — we’re only interested in the Pull request event.
Make sure to check the repository for more information on all the configuration options. ∎