How to Link Azure Boards with GitHub Commits and Pull Requests

TL/DR: When using Azure Boards to track work items, these work items can be linked to GitHub commits and pull requests. When doing so, updates to the pull requests are also noted in the work item. Once the pull request has been merged, the Azure Boards work item automatically resolved. For detailed information, see the GitHub and Azure Boards documentation.

Quick and fun blog post with lots of pictures for today. The scenario is that my organization, let's call them Tailwind Traders, stores Azure Templates in GitHub and have a nightly Azure Pipelines build to lint and ensure proper configuration of these templates. Recently these builds started failing.

2.jpg

So, we are going to need to but first I will create an Azure Boards bug so that we can track the work.

3.jpg

Connect Azure Boards to GitHub

Before and potentially fixing the template issue. Let's link the Azure project to our GitHub repository. To do so, navigate to the project settings and select GitHub Connections and follow the on-screen prompts.

For more information on this operation, see Connect Azure Boards to GitHub

1.jpg

Fix template and create a pull request

Now that we have a. identified the issue and b. linked the Azure project with GitHub, we can begin to work the issue.

I am going to first move the work item from the new column to the Active column to signal to my team that I am working the issue. This also sets the state of the work item to Active.

4.jpg

Looking at the Azure template, I see that a simple comma is missing which has invalidated the template. I've added the comma and created a pull request for the fix. Take note here of the commit message. I've added to the message Fixes: AB#34. This string of text here will link this commit and PR to the Azure Boards work item.

For more information on this operation, see Link GitHub commits and pull requests to work items.

5.jpg

Because we have continuous integration and pull request validation enabled in our Azure project, I can see directly in the pull request that a build has been triggered to validate proper configuration of that Azure template.

6.jpg

I can also see the build in Azure DevOps itself.

7.jpg

What is really cool is that because I have created the link between my Azure DevOps project and GitHub and have used the correct strings in my commit message, all GitHub activity is now logged to the Azure Boards work item.

8.jpg

Merge pull request and close bug

Once the build has completed successfully, someone from my team will validate my work and merge the pull request. Because of the link between Azure Boards and GitHub account not only will the merge operation be logged to the Azure Boards work item:

9.jpg

the work item is also automatically is resolved.

1.gif

That was super fun to work through. Feel free to reach out in comments or on Twitter @nepeters.

 

This article was originally published by Microsoft's Azure Blog. You can find the original article here.