GitHub Issues – Do you sync to Azure DevOps?

Updated by Tiago Araújo [SSW] 3 years ago. See history

123

<introEmbed
  body={<>
If you store all your code in GitHub, why not create all your issues there too?

You might be reluctant to move your backlog to GitHub from Azure DevOps as you don’t want to lose the metrics functionality.

But you can easily sync all your GitHub Issues to Azure DevOps automatically to have the best of both worlds.
  </>}
/>
Here's a quick guide in setting it up for your GitHub Repository and Azure DevOps.

1. Install the [Azure Boards App](https://github.com/marketplace/azure-boards) from the GitHub Marketplace
2. Create the GitHub Action secrets

* **ADO_PERSONAL_ACCESS_TOKEN** (Azure DevOps | User settings | Security | Personal access tokens)
  The [Azure Personal Access Token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?WT.mc_id=AZ-MVP-33518) requires "read & write" permission for Work Items.

* **GH_PERSONAL_ACCESS_TOKEN** (GitHub | Personal settings | Developer settings | Personal access tokens)
  The [GitHub Personal Access Token](https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) requires "repo" permissions.

* **ADO_ORGANIZATION** (https:// **ssw** .visualstudio.com/SSW.Rules)
  The Organization name is in your Azure DevOps URL.

* **ADO_PROJECT** (<https://ssw.visualstudio.com/> **SSW.Rules**)
  The Project name can also be found in your Azure DevOps URL.

3. Create the following GitHub Action

E.g. SSW uses this template for their projects, you may need to change the new and closed states depending on your environment.

```git
name: Sync issue to Azure DevOps work item
on:
  issues:
    types:
      [opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned]

jobs:
  alert:
    runs-on: ubuntu-latest
    steps:
      - uses: danhellem/github-actions-issue-to-work-item@master
        env:
          ado_token: "$&#123;&#123; secrets.ADO_PERSONAL_ACCESS_TOKEN &#125;&#125;"
          github_token: "$&#123;&#123; secrets.GH_PERSONAL_ACCESS_TOKEN &#125;&#125;"
          ado_organization: "$&#123;&#123; secrets.ADO_ORGANIZATION &#125;&#125;"
          ado_project: "$&#123;&#123; secrets.ADO_PROJECT &#125;&#125;"
          ado_wit: "Product Backlog Item"
          ado_new_state: "New"
          ado_close_state: "Done"
          ado_bypassrules: true
```

<figureEmbed figureEmbed={{
  preset: "goodExample",
  figure: 'Figure: Good Example - GitHub Action to Sync Issues to Azure DevOps',
  shouldDisplay: true
} } />


<imageEmbed
  alt="Image"
  size="large"
  showBorder={false}
  figureEmbed={{
    preset: "goodExample",
    figure: 'Good Example - GitHub Issues Syncing to Azure DevOps',
    shouldDisplay: true
  }}
  src="/uploads/rules/sync-your-github-issues-to-azure-devops/GitHub-Issues-Syncing-to-AzDevOps.png"
/>

### Pros

* Easily manage Sprints and calculate burndown and cycle time
* See all your GitHub Issues and Azure DevOps PBIs in one Backlog
* Automated tagging and hyperlinking between Issues and PBIs

### Cons

* The sync is only one-way GitHub Issues -&gt; Azure DevOps Backlog
* It won’t sync existing GitHub Issues unless they are updated

More information about this GitHub Action can be found here <https://github.com/danhellem/github-actions-issue-to-work-item>

To avoid people adding a PBI to the Azure DevOps, add a PBI at the top of your backlog to indicate that they should add it to GitHub issues.


<imageEmbed
  alt="Image"
  size="large"
  showBorder={false}
  figureEmbed={{
    preset: "default",
    figure: 'Add the PBI at the top of your backlog',
    shouldDisplay: true
  }}
  src="/uploads/rules/sync-your-github-issues-to-azure-devops/GitHub-PBI-Backlog.png"
/>


<imageEmbed
  alt="Image"
  size="large"
  showBorder={false}
  figureEmbed={{
    preset: "default",
    figure: 'Inform users where to add new PBIs',
    shouldDisplay: true
  }}
  src="/uploads/rules/sync-your-github-issues-to-azure-devops/GitHub-PBI-Backlog-Text.png"
/>

Acknowledgements

Christian Morford-Waite
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.