Your Waffle.io board can track when your issues and pull requests are deployed, automatically!

How does it work? On pull requests in Waffle, you’ll see when deployments start and if they fail or are successful with our new rocket badge. This works for all types of deployments, whether it’s for an open pull request to a staging environment or a deployment to production for a merged pull request.

Waffle will also automatically move work across the board for you as well when deployments are successful! First, make sure you see the rocket icon on PRs that are deployed, and then create a column on your board with a label that matches the name of the environment (what you see in the rocket badge).

If you’re using Heroku, GitHub is automatically notified when deployments happen. If you’re on a different platform, there’s a bit of work to notify GitHub. Jump down below to learn how to set this up for your own deployment system!

After that, everything is magic ✨. When a deployment is successful, Waffle will move the pull request and any related issues to the appropriate column for you. That’s it!

Notifying GitHub of Deployments

Don’t use Heroku, and don’t see the rocket badges on your pull requests?

You can notify GitHub yourself when deployments happen. Here’s how we’ve implemented this in our deploy process, using CircleCI.

When you trigger a deployment, tell GitHub about it by creating a deployment event. We use a deploy.sh script as part of our CircleCI build where we notify GitHub:

#!/bin/bash

# Create a deployment
create_gh_deployment () {
  curl -s -X POST "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/deployments" \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/vnd.github.ant-man-preview+json' \
      -u ${GITHUB_ACCESS_TOKEN} \
      -d "{"ref": "${CIRCLE_SHA1}", "environment": "${environment}", "required_contexts": [], "auto_merge": false}"
}

# Run this function when you trigger a deploy.
# Keep track of the deployment id as $gh_deploy_id for later. We're using https://stedolan.github.io/jq/ to parse the JSON to grab the id.
declare -r created_gh_deployment=$(create_gh_deployment)
declare -r gh_deploy_id=$(echo $created_gh_deployment | jq .id)

We rely on several environment variables supplied by CircleCI, your own CI tool may look different. We’re also using one our our team’s GitHub API tokens to create the deployment event.

When a deployment finishes, notify GitHub of the success or failure:

#!/bin/bash

# Notify GitHub of a successful deployment
notify_gh_about_a_deployment () {
  declare -r deployment_id=${1}
  declare -r deployment_status=${2}
  curl -s -X POST "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/deployments/${deployment_id}/statuses" \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/vnd.github.ant-man-preview+json' \
    -u ${GITHUB_ACCESS_TOKEN} \
    -d "{"state": "${deployment_status}", "log_url": "${CIRCLE_BUILD_URL}"}"
}

# When a deploy is successful:
notify_gh_about_a_deployment $gh_deploy_id "success"


That’s it! You’ll start seeing rocket ships on your board. 🚀

Check out GitHub’s API docs for deployments for more details: https://developer.github.com/v3/repos/deployments/


**Don’t see this feature on your Waffle board? You may be on our legacy account. We’d love for you to start a trial to checkout all the goodies you’re missing like this one! Contact us (support@waffle.io) to start a free trial.

Did this answer your question?