Search code examples
azure-devopsjirawebhooks

Call Jira webhook on Azure DevOps pull request


I need to call a Jira webhook with a specific url and post body when a pull request is completed that contains a certain branch name. I am using Azure DevOps for builds and repos.

Is there a way to do this via interface or is it necessary to make a workaround via pipeline?


Solution

  • In Project Settings page you can find "Service hooks" feature. You can use this feature to automatically react into things that happens inside Azure DevOps. For example when someone completes a pull request.

    1. Click green plus icon at the Service hooks page.
    2. Select "Web Hooks"
    3. Select "Pull request merge attempted"
    4. Select suitable repos etc. and on Merge result select "Merge Successful" as you want to run your trigger when pull request is completed.

    You cannot build this rule by wildchar branch name, but you can build it for specific branch name. If you need wildchar branch name, you could maybe create team called "Post To Jira" and make the rule so that if reviewer contains "Post To Jira" => call Jira. Problem in this solution is of course that users needs to remember to add the "Post To Jira" as reviewer.

    One final thing to note is, that there are some good plugins for Azure DevOps and Jira integrations that can do much more than simple http call.

    enter image description here