How to Link Azure DevOps Tickets to GitHub Pull Requests for Better Project Management

Author

Reads 554

Woman in focus working on software development remotely on laptop indoors.
Credit: pexels.com, Woman in focus working on software development remotely on laptop indoors.

Linking Azure DevOps tickets to GitHub pull requests is a game-changer for project management. This integration allows you to track issues and bugs directly in your code repository, making it easier to manage your project's workflow.

In Azure DevOps, you can link a GitHub pull request to a work item, such as a bug or feature request, by using the "Link to work item" feature. This feature is available in the GitHub pull request interface.

By linking your GitHub pull requests to Azure DevOps work items, you can track the status of your code changes and ensure that they align with your project's requirements. This integration also enables you to automate workflows and streamline your development process.

Prerequisites

To link Azure DevOps tickets to GitHub pull requests, you'll need to meet some prerequisites. Your Azure Boards project must be connected to the GitHub repository where the commits and pull requests you want to link to/from exist.

Credit: youtube.com, How to Link Azure DevOps work items in GitHub Automatically

To get started, ensure you're a Contributor to Azure Boards, as well as a Contributor to the GitHub repository. This will give you the necessary permissions to link tickets and pull requests.

If your organization uses the Hosted XML process model, you'll need to update the work item types to link to and view the GitHub link types from the Development section in the work item form.

Connecting Azure DevOps to GitHub

Connecting Azure DevOps to GitHub is a straightforward process that allows you to link between GitHub commits and pull requests to work items in Azure Boards.

You can connect your Azure DevOps Server project to your GitHub repositories, supporting linking between GitHub commits and pull requests to work items. This enables you to use GitHub for software development while using Azure Boards to plan and track your work.

To connect Azure DevOps Server to GitHub, you can register Azure DevOps in GitHub as an OAuth App, which is required for using OAuth to connect Azure DevOps Server with your GitHub Enterprise Server.

Credit: youtube.com, Connect GitHub Repository to Azure DevOps Pipeline | Ep-6

If you're using Azure DevOps Server 2019, you can connect up to 100 GitHub repositories to an Azure Boards project, a limit that can't be changed.

Here's a step-by-step guide to connecting Azure DevOps Server to GitHub Enterprise Server:

  1. Open the web portal for your Azure DevOps Server.
  2. Select the Azure DevOps logo to open Projects, and then choose the Azure Boards project you want to configure to connect to your GitHub Enterprise repositories.
  3. Select Project settings > GitHub connections.
  4. Choose the authentication method you want to use to make the connection, such as your GitHub credentials or a personal access token or username and password.

You can connect up to 250 GitHub repositories to an Azure Boards project, depending on your Azure DevOps Server version. For example, if you're using Azure DevOps Server 2020, you can connect up to 250 repositories, whereas Azure DevOps Server 2019 has a limit of 100 repositories.

Azure CLI and Azure DevOps

Azure CLI is a powerful tool for managing Azure DevOps projects. You can use it to add, remove, or show links to work items.

To add a link, you'll need to use the az boards work-item relation command. This command allows you to specify the type of link you want to add, such as a work link, remote link, hyperlink, or attached file.

Credit: youtube.com, Git - Pull Requests | Azure Repos | Azure DevOps Tutorial | An IT Professional

The az boards work-item relation list-type command will give you a list of all the link types you can specify. This is useful if you're not sure what type of link you need to add.

To connect Azure DevOps Server to GitHub, you can follow the instructions in the Azure DevOps documentation. This will allow you to link between GitHub commits and pull requests to work items.

To add a link from a work item to a GitHub commit or pull request, you'll need to open the work item and choose Add Link under the Development section. Then, select the GitHub Commit or GitHub Pull Request link type, enter the URL to the commit or pull request, and choose OK.

Here are the link types you can specify when adding a link:

Azure DevOps Configuration

To configure Azure DevOps for linking tickets to GitHub pull requests, you first need to connect your Azure DevOps Server project to your GitHub repositories. This supports linking between GitHub commits and pull requests to work items, allowing you to use GitHub for software development while using Azure Boards to plan and track your work.

Credit: youtube.com, Integrate Azure Boards and GitHub NOW!

You can connect up to 250 GitHub repositories to an Azure Boards project, but if you're using Azure DevOps Server 2019, the limit is 100 repositories. To make a connection, open the web portal for your Azure DevOps Server, select the Azure DevOps logo to open Projects, and choose the Azure Boards project you want to configure.

To register Azure DevOps in GitHub as an OAuth App, you first need to create an OAuth App. This is required if you plan to use OAuth to connect Azure DevOps Server with your GitHub Enterprise Server.

Register Azure DevOps OAuth App

To register Azure DevOps as an OAuth App, you first need to create an OAuth App. This is a necessary step if you plan to use OAuth to connect Azure DevOps Server with your GitHub Enterprise Server.

You can create an OAuth App by following the instructions in the Azure DevOps documentation, specifically in the section "Register Azure DevOps in GitHub as an OAuth App." This will guide you through the process of creating an OAuth App and registering it with GitHub.

Credit: youtube.com, SERVICE CONNECTIONS | Connect Your AZURE SUBSCRIPTION and AZURE DEVOPS Account

Creating an OAuth App is a straightforward process that involves providing some basic information about your Azure DevOps Server instance. Once you've completed the registration process, you'll be able to use OAuth to connect Azure DevOps Server with your GitHub Enterprise Server.

Here are the steps to register an OAuth App:

1. Go to the GitHub OAuth Apps page.

2. Click on the "New OAuth App" button.

3. Fill in the required information, such as the name and description of your app.

4. Click on the "Register Application" button.

That's it! With these steps, you'll have successfully registered your Azure DevOps OAuth App.

Deployment Control

The Deployment Control is a powerful feature in Azure DevOps that allows you to quickly view and navigate to development objects from work item forms.

By default, the Deployment control appears on the work item forms for several work item types, including User Story, Product Backlog Item, and Bug.

This control only shows work items linked to a Git commit or pull request for the pipeline, providing visual insight into the status of a work item as it's deployed to different release environments.

Credit: youtube.com, Azure DevOps for Power Apps | Source Control

You can go to each release stage and run from the Deployment control.

Only work items within the same project get linked to the release pipeline, and work items associated with commits in the build show the status of the release.

To populate the Deployment control, you need to define a Classic release pipeline and set up the release stages, as well as configure the pipeline to support work tracking.

Here are the steps to configure the Deployment control:

  1. Define a Classic release pipeline and set up the release stages.
  2. Configure the pipeline to support work tracking.
  3. Link work items to a commit or pull request in Azure Repos Git repository.
  4. Run the pipeline.

The Deployment control requires configuration of a Classic release pipeline, which doesn't support linking to release stages defined for a YAML pipeline.

GitHub Integration

GitHub Integration is a powerful feature that allows you to link your Azure Boards work items to your GitHub commits and pull requests.

To link a commit or pull request to an Azure Boards work item, you can use the AB# mention syntax in the commit message or pull request title/description. For example, AB#125 will link to work item ID 125.

Credit: youtube.com, GitHub Integration with Azure DevOps | Add link to GitHub commit | Update state from GitHub

You can also use the AB# mention syntax to transition the work item to a different state. For instance, entering "Fixed AB#123" in a commit message will link and transition the work item to the "done" state.

Here are some examples of how you can use the AB# mention syntax:

From the Azure Boards side, you can also add a link from a work item to a GitHub commit or pull request by following these steps: Open the work item and choose Add Link under the Development section. From the Add link dialog, select the GitHub Commit or GitHub Pull Request link type, enter the URL to the commit or pull request, and then choose OK.

Troubleshooting and Next Steps

If you're still experiencing issues linking Azure DevOps tickets to GitHub pull requests, check that the Azure DevOps project is properly connected to your GitHub repository.

First, ensure that the Azure DevOps project is configured to use GitHub as the Git provider. This is typically done during the initial setup process, but it's easy to miss. Make sure the project's Git provider is set to GitHub in the project settings.

If the connection is established, but you're still having trouble, try re-linking the Azure DevOps project to your GitHub repository by following the steps outlined in the "Configuring Azure DevOps to use GitHub" section. This usually resolves any issues with syncing tickets and pull requests.

Resolve Access Issues

Credit: youtube.com, Fix Access Issues in a Flow | ​Flow Troubleshooting

Resolve access issues by checking the Azure Boards connection to GitHub. If you see a red-X alert in the user interface, hover over it to see the tooltip, which may indicate that the credentials are no longer valid.

To correct the problem, remove the existing connection and recreate a new one. This is especially important if the connection is using OAuth or a Personal Access Token (PAT).

If the connection is using OAuth, you'll need to re-authorize Azure Boards to access your GitHub account. This is a simple process that will allow you to regain access to your GitHub repositories.

If the connection is using a PAT, you'll need to generate a new token and update the Azure Boards connection with the new PAT.

Here are the steps to resolve access issues:

  • Remove the existing Azure Boards connection to GitHub.
  • Recreate a new connection using OAuth or a new PAT.

Next Steps

Now that you've connected Azure Boards with GitHub repositories, it's time to link work items to your GitHub objects. You can link work items to a GitHub Commit, GitHub Pull Request, GitHub Branch, and GitHub Issue.

Female Software Engineer Coding on Computer
Credit: pexels.com, Female Software Engineer Coding on Computer

To link work items to GitHub Pull Requests, simply enter # in the description of your pull request to trigger the #ID work item picker. This will display a list of 50 work items that you recently modified or are assigned to you.

To narrow the list, enter up to five keywords that match the work item type, ID, or title. This will help you quickly find the relevant work item.

Here's a step-by-step guide to linking work items to GitHub objects:

  • Link work items to GitHub Commits and Pull Requests
  • Use the Commit link type to link work items to commits in Git
  • Add work item IDs in Git Changes for Visual Studio 2022 or Team Explorer for previous versions of Visual Studio
  • Use the git-commit command and include the work item ID in your comment
  • Use the Development control for git development from the work item

By following these steps, you can create a seamless connection between your work items and GitHub objects, making it easier to track and manage your development workflow.

Frequently Asked Questions

How do I link a pull request to a ticket in GitHub?

To link a pull request to a ticket in GitHub, use a supported keyword in the pull request's description or commit message on the default branch. This keyword will automatically connect the pull request to the relevant issue.

Jennie Bechtelar

Senior Writer

Jennie Bechtelar is a seasoned writer with a passion for crafting informative and engaging content. With a keen eye for detail and a knack for distilling complex concepts into accessible language, Jennie has established herself as a go-to expert in the fields of important and industry-specific topics. Her writing portfolio showcases a depth of knowledge and expertise in standards and best practices, with a focus on helping readers navigate the intricacies of their chosen fields.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.