If you’re using Travis CI, Code Climate, or one of many other CI tools with Github, you’ve probably noticed the little checklist of items that shows just above the “merge” button when you open a pull request.
These are called commit “statuses”, and there is a Github API for reporting these (Gitlab also has a similar API). If you are using a git sha for the consumer version number when you publish your pacts, you can now use Pact Broker webhooks to report the verification statuses of your pacts back to Github.
To do this, open up your Pact Broker API Browser, and click on the
NON-GET button next to the
pb:webhooks relation. Modify the JSON below to match your consumer, repository and Github auth details (we recommend you make a separate token for this purpose with the
repo:status grant), and click
If all your consumer names match their repository names in Github, you can make this a global webhook by removing the
consumer node and replacing the hardcoded
<project> name in the URL with the parameter
Want to use this cool feature? You’ll need version 2.21.0 or later of the Pact Broker.
Check out the webhook template library for more handy webhooks.
This post first appeared on the pact blog here and is re-posted with permission.