GitHub and Azure DevOps Integration

House icon

Published February 27, 2019

Principal Consultant

Magnus Timner

<p><span style="font-size: 12pt;">Azure DevOps is growing and nothing indicates that its popularity will decrease. Along with this, several new integrations and possibilities open up. In this blog post, I will describe how to set up the GitHub and Azure DevOps integration. More specifically, this is how to get GitHub working with Azure Pipelines and Azure boards.</span></p> <h2><strong>GitHubs and Azure Pipelines</strong></h2> <p><span style="font-size: 12pt;">Start by logging in to your GitHub project.</span></p> <figure id="attachment_4580" class="thumbnail wp-caption aligncenter style="width: 2823px"><img class="wp-image-4580 size-full" src="https://www.datocms-assets.com/15783/1572624633-github-1.png" alt="" width="2813" height="751" /><figcaption class="caption wp-caption-text">Log in to your GitHub project</figcaption></figure> <p><span style="font-size: 12pt;">Select Marketplace, search for and add Azure Pipelines. It&#8217;s kind of nice that you can build for Windows, Linux and Mac out of the box.</span></p> <figure id="attachment_4581" class="thumbnail wp-caption aligncenter style="width: 898px"><img class="wp-image-4581 size-full" src="https://www.datocms-assets.com/15783/1572624650-github-2.png" alt="" width="888" height="644" /><figcaption class="caption wp-caption-text">Azure Pipelines</figcaption></figure> <p>&nbsp;</p> <p><span style="font-size: 12pt;">With Azure Pipelines, you can connect to an existing Azure DevOps organization &#8211; or create a new one. Now, log in to Azure DevOps and setup a new build selecting the GitHub or GitHub Enterprise source control option.</span></p> <figure id="attachment_4582" class="thumbnail wp-caption aligncenter style="width: 2609px"><img class="wp-image-4582 size-full" src="https://www.datocms-assets.com/15783/1572624666-github-3.png" alt="" width="2599" height="1000" /><figcaption class="caption wp-caption-text">GitHub</figcaption></figure> <p><span style="font-size: 12pt;">You will have to authenticate to GitHub with a PAT token. After that, select triggers to set up CI and/or Pull Request builds.</span></p> <figure id="attachment_4583" class="thumbnail wp-caption aligncenter style="width: 2156px"><img class="wp-image-4583 size-full" src="https://www.datocms-assets.com/15783/1572624688-github-4.png" alt="" width="2146" height="1144" /><figcaption class="caption wp-caption-text">Triggers</figcaption></figure> <p><span style="font-size: 12pt;">The result in GitHub after doing a Pull request looks like this:</span></p> <figure id="attachment_4584" class="thumbnail wp-caption aligncenter style="width: 1659px"><img class="wp-image-4584 size-full" src="https://www.datocms-assets.com/15783/1572624702-github-5.png" alt="" width="1649" height="1006" /><figcaption class="caption wp-caption-text">Result</figcaption></figure> <p><span style="font-size: 12pt;">When you click on <em>Details</em>, you see the actual build in Azure DevOps.</span></p> <figure id="attachment_4585" class="thumbnail wp-caption aligncenter style="width: 1730px"><img class="wp-image-4585 size-full" src="https://www.datocms-assets.com/15783/1572624719-github-6.png" alt="" width="1720" height="1019" /><figcaption class="caption wp-caption-text">Details</figcaption></figure> <h2><strong>GitHub and Azure Boards</strong></h2> <p><span style="font-size: 12pt;">Next, we look ad Azure Boards. Boards is the agile planning part of Azure DevOps, including backlogs, Kanban boards and sprint planning.</span></p> <p><span style="font-size: 12pt;">Start by logging in to Azure DevOps and select <em>Project settings</em>, then <em>GitHub connections </em>and finally connect to your GitHub account.</span></p> <figure id="attachment_4586" class="thumbnail wp-caption aligncenter style="width: 2463px"><img class="wp-image-4586 size-full" src="https://www.datocms-assets.com/15783/1572624734-github-7.png" alt="" width="2453" height="1753" /><figcaption class="caption wp-caption-text">Connect with Azure Boards</figcaption></figure> <p><span style="font-size: 12pt;">To connect a commit or Pull request to a work item in Azure DevOps you need to use the following syntax in the commit message or Pull request title:</span><br /> <span style="font-size: 12pt;">AB#{id}</span></p> <figure id="attachment_4587" class="thumbnail wp-caption aligncenter style="width: 1555px"><img class="wp-image-4587 size-full" src="https://www.datocms-assets.com/15783/1572624751-github-8.png" alt="" width="1545" height="673" /><figcaption class="caption wp-caption-text">Syntax</figcaption></figure> <p><span style="font-size: 12pt;">The result is shown here if we open a work item connected to a pull request or commit.</span></p> <figure id="attachment_4588" class="thumbnail wp-caption aligncenter style="width: 2447px"><img class="wp-image-4588 size-full" src="https://www.datocms-assets.com/15783/1572624759-github-9.png" alt="" width="2437" height="685" /><figcaption class="caption wp-caption-text">Result</figcaption></figure> <figure id="attachment_4589" class="thumbnail wp-caption aligncenter style="width: 2690px"><img class="wp-image-4589 size-full" src="https://www.datocms-assets.com/15783/1572624766-github-10.png" alt="" width="2680" height="755" /><figcaption class="caption wp-caption-text">Result</figcaption></figure> <h2><strong>Summary</strong></h2> <p><span style="font-size: 12pt;">That covers the integration today and both the GitHub &#8211; Azure Pipelines and GitHub &#8211; Azure Boards work really well. One thing that I think is missing is some kind of integration between GitHub issues and Azure Boards. Hopefully we will see that added soon.</span></p> <h3><strong>Links</strong></h3> <p><span style="font-size: 12pt;">GitHub: <a href="https://github.com/">https://github.com/</a></span></p> <p><span style="font-size: 12pt;">Azure DevOps: <a href="https://dev.azure.com/">https://dev.azure.com/</a></span></p>