How to configure merge commit template on Azure DevOps - azure-devops

Is it possible to configure merge commit template on Azure DevOps?
I would like to for example to Azure add Pull Request link to merge commit when I'm completing Pull Request.
EDIT:
when I'm completing Pull Request then Azure DevOps shows window Complete pull request like on the picture. Azure DevOps automatically add line Related work items: #29272156 and I would like to Azure DevOps add also link to completed pull request.

You can use Pull request templates: Improve pull request descriptions using templates. All information from the pull request description will be moved to the commit description.
A link to a source pull request you can find in the details tab of your commit:
Additionally, you can find this info in Visual Studio:

Related

Azure Devops GIthub webhooks

We had azure pipeline which use to work, but recently the PR trigger are not working.
Hence, I deleted webhooks from github repo. I created new service account and new pipeline with new service account. However, it does not seem to recreate webooks in github.
any thoughts?
Which model are you using, classic editor build or YAML build?
If you are using YAML build, we could select GitHub as source.
And we could specify the target branches when validating your pull requests. For example, to validate pull requests that target master and releases/*, you can use the following pr trigger.
pr:
- master
- releases/*
If you are using classic editor build. We could select the Pull request validation trigger and check the Enable pull request validation check box to enable builds on pull requests. Check the pic below.
We could refer to this doc for more details.

Auto Associate Related Work Items to Pull Request via Azure CLI

When a pull request is created using the Azure Devops website, it automatically associates related work items for the commits to be merged. However, when a pull request is created using the Azure CLI (az repos pr create) the work items are not associated.
Is there a way to automatically associate the works items via the Azure CLI? They can be manually associated with az repos pr work-item add, but I'm hoping there is a way to have it happen automatically like the site does.
Not now. There is a bug for this behaviour: [Bug] Different Behavior on "az repos pr create" and web interface.

Automatically adding comments to all Pull Requests in Azure DevOps

Is there a way to automatically add comments to any pull requests created in Azure DevOps within a repository?
Is there a way to automatically add comments to any pull requests created in Azure DevOps within a repository?
I am afraid there is no such way to automatically add comments to any pull requests created in Azure DevOps within a repository.
That because we are currently unable to monitor the creation of pull requests in real time. And there is no similar extension to detect the creation of pull requests. In this case, we could set the action to add comment to the all pull requests.
To achieve this, we could try to add a Build Validation for each branch, and use the REST API Pull Request Thread Comments - Create to add comments to the pull requests.
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/threads/{threadId}/comments?api-version=5.1
You could check this thread for the details info about how to use this REST API.
In this case, if we create any pull request, it will invoke the Build Validation to use REST API to add comments to the pull request.
Our team had similar needs so I created an Azure DevOps task to do just that:
PR Auto-Comment (GitHub)
Just add the task to your PR build and you're good to go.
Depending on your exact need, you may be able to use the "Automatically included reviewers" functionality that you get with branch policy. It has a custom message that can be configured to be included in every PR.

Creating Connection Bitbucket with AzureDevOps

I have a bitbucket repository.
I want pipelines in AzureDevops to build sources when i make a pull request in Bitbucket.
I set up PR trigger in yaml files.
But it did not work when i made a pull request.
I tried to run the pipeline manually, it worked and succeeded.
I guess, bitbucket could not send a message to azure when pull requests are made.
How to set up connection Bitbucket with AzureDevOps?
Integration between BitBucket Cloud and Azure Pipelines:
https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/bitbucket?view=azure-devops&tabs=yaml
You can specify the target branches when validating your pull requests. For example, to validate pull requests that target master and releases/*, you can use the following pr trigger.
pr:
- master
- releases/*
This configuration starts a new run the first time a new pull request is created, and after every update made to the pull request.

Triggering Pull Request Builds automatically on draft pull requests in Azure DevOps (ADO)

If I make a pull request in ADO from one of my branches then any commits I push to my branch automatically trigger the build pipeline:
This is configured in the build validation branch policies on master:
But for draft pull requests I need to trigger builds manually:
The documentation (here) does not mention any distinction between active and draft pull requests. How do I configure my project so that commits to branches in a draft pull requests automatically trigger a build?
According to the docs:
Draft pull requests do not include reviewers or run builds by default
but allow you to manually add reviewers and run builds. To promote the
pull request to a normal pull request, simply click the Publish button
from the pull request detail page.
So, it looks like you experience the expected behavior.