I'm trying to automate some post-release processes for creating Pull Requests (release branch -> master) after a release. While I'm able to automate the PR creation, and it links the commits, it does not link the work items.
Note: I'm using Python for this, using the (officially supported) azure-devops module from PyPi (https://pypi.org/project/azure-devops/). It is a thin wrapper around the REST API, and I've read the REST API documentation itself to see if there are any other options (haven't found any so far). Here's my code:
def create_pull_request(self, repo_id, source_branch, target_branch, title, description):
pull_request = {
"title": title,
"description": description,
"sourceRefName": "refs/heads/" + source_branch,
"targetRefName": "refs/heads/" + target_branch,
}
response = self._git_client.create_pull_request(pull_request, repository_id=repo_id)
Here's my function for connection to the git client:
def __init__(self, personal_access_token=None, organization_url=None):
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
self._connection = azure.devops.connection.Connection(base_url=organization_url,
creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
self._git_client = self._connection.clients.get_git_client()
I've also tried pulling the individual commits to see if I can find the work items associated with them and attached them to the pull request after creation, but those responses are coming back with the work items empty.
Is there some other way I can accomplish this?

