GitHub's Status API allows you to update the status of a commit, or pull request. Continua CI 1.0 has an Action which allows you to do this during a Stage, but it is somewhat cumbersome to use, because you typically need three actions to update the status to pending at the start of the stage, and then success or failure at the end.
Build Event Handlers
Continua CI 1.5 adds a new feature to Configurations - Build Event Handlers
. These are tasks that run on the Server (unlike Stages & Actions which run on the Agent). In Continua CI 1.5 there are handlers for Octopus Deploy
, Tagging Repository Changesets
and Updating GitHub Status
(which is the focus of this post).
So lets take a look at the Update GitHub Status event handler. Build Event Handlers are on the (new) Events page of the Configuration Wizard - click on [Create] to add a new handler
Give the Event Handler a Name and select the "Update GitHub Status" type. The handler specific tabs will then show up
Note, use either your GitHub Username and Password, or an Access Token (you can create one in your GithHub user profile - applications page). Specify the name(s) of the repositories you want to update. Note that these must match the names of Continua CI repositories associated with the build.
You can specify the Start and End Stages, which control when the status is updated to Pending and then Success or Failure.
You can customise the status messages - the default ones will insert the project & configuration names along with the build version. Note that GitHub Status messages have a 140 char limit (must have some ex twitter staff, why else would the limit be so short??).
If you don't care about the results of the status updates, you can turn off the 'Wait for Results" option and your build will take a few seconds less.
Ok, so what happens when you run a build. In this example, I told Continua CI to build a pull request branch, and when the build starts, I see this on the Pull request page :
When the build completes successfully I see this :
This is an immensely useful feature, I have this configured on my open source projects on GitHub, and usually by the time I get to look at the pull request, Continua CI has already built it and updated the status. If the build failed, well then I know not to bother merging.