Search code examples
githubazure-pipelinesworkitemazure-pipelines-build-taskbuild-agent

Team Services - Create issue in Github on failed build


I am using Github as my repo as well as my Kanban/Scrum board. We use Visual Studio Team Services for our automated builds. We really like the way VSTS works and it works well with Github as the repo.

However, I want to be able to create a new Github issue/bug if and when our Continuous Integration build fails. I know you can create a VSTS Work Item but I would rather keep all issues centralized.

Is there any way to hook up VSTS to create a Github repo whenever a build fails? Or perhaps create a Github issue whenever a new VSTS Work Item is created?

We are running our own build server so possibly something can be done on that end?


Solution

  • Yes, you can create a github issue when VSTS build failed with two options.

    Option1:

    In VSTS build definition, add a powershell task in the end of the build process. Functions in the powershell should include:

    1. Detect above build tasks in the build definition. Use REST API timeline to get build detail, you can find each task result in result parameter.
    2. Determine to create a github issue or not. If all above build tasks are pass to build, don’t create github issue. Else, create a github issue by github API.

    Option2:

    Create your own website, and in VSTS use web hooks to tigger build fail information for your own website. After your own website receive the build information, it can create a github issue.