microsoft / microsoft/azure-devops-python-api

Defining "auto_complete_set_by" attribute to GitPullRequest object doesn't make PR auto-completed

未关闭
#326 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
684
派生
218
平均合并
8 天 10 小时
30 天内合并 PR
1

描述

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!

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 GitPullRequest.auto_complete_set_by 和 GitPullRequestCompletionOptions 字段开始,然后追踪 git_client.create_pull_request 如何发送它们。将生成的请求与 Azure DevOps 的自动完成要求进行比较;完成的标准是,在所述条件下创建的 pull request 会自动完成。Issue 中未指定文件或测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, git, python
领域
api
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。