microsoft / microsoft/azure-devops-python-api
Defining "auto_complete_set_by" attribute to GitPullRequest object doesn't make PR auto-completed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 684
- Forks
- 218
- Avg merge
- 8d 10h
- Merged PRs (30d)
- 1
Description
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!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GitPullRequest.auto_complete_set_by and GitPullRequestCompletionOptions fields, then trace how git_client.create_pull_request sends them. Compare the resulting request with Azure DevOps auto-complete requirements; done means a created pull request auto-completes under the stated conditions. No file or test is identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, git, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100