azure-devops-python-api
azure-devops-python-api copied to clipboard
Defining "auto_complete_set_by" attribute to GitPullRequest object doesn't make PR auto-completed
Hi, I'm seeing an unexpected behaviour when I try to create a PR that auto-completes. This is a snippet:
import azure.devops as azdo
import azure.devops.released.git as azdo_git
...
pr = azdo_git.GitPullRequest(
auto_complete_set_by=(
azdo_git.IdentityRef(id="<some id>")
),
title='title',
description='description',
source_ref_name='source_ref_name',
target_ref_name='target_ref_name',
completion_options=azdo_git.GitPullRequestCompletionOptions(
# also tried with merge_strategy=False, same result
merge_strategy="noFastForward",
delete_source_branch=True, triggered_by_auto_complete=True
),
reviewers=self.set_pr_reviewers(self.pr_reviewer_ids),
)
azdo_connection = azdo.connection.Connection(base_url=self.organization_url, creds=credentials)
git_client = azdo_connection.clients.get_git_client()
repository_id = "<some repo id>"
project_id = "<some project id>"
git_client.create_pull_request(
pr,
repository_id,
project_id,
)
I have made sure that the user ID for auto-complete is correct (the one passed into IdentityRef())
the resulting PR is successfully created, all looks good except it's not auto-completed. The PR has no attached pipeline or branch policy, so I can't figure out why it won't work.
Any help is appreciated, thanks!