英文:
Can ADO REST API link branch to a work item and have it auto displayed in pull request for that branch?
问题
我成功调用 ADO REST API 来链接一个分支(我们称之为“目标”)到一个工作项,之后我从 ADO web portal 创建了一个拉取请求,从私有分支到“目标”分支,我期望网页显示工作项链接到拉取请求,不幸的是没有。我知道工作项可以自动链接到拉取请求。如果分支从 web portal 链接到工作项,比如在链接中编辑工作项,或在创建分支时将工作项添加到新分支,那么拉取请求创建页面将自动显示该工作项链接到拉取请求。**我的问题是,在调用 ADO REST API 时缺少了什么,以使 REST API 完成的链接不能自动将工作项链接到拉取请求呢?**我调用的用于将分支链接到工作项的 REST API 是工作项 - 更新,使用的负载类似于这篇帖子。与此同时,我知道从 ADO web portal,在创建链接到工作项的分支时,调用的 REST API 不是我上面使用的那个,而是 /_api/wit/$batch,使用 PATCH 方法,负载与工作项更新中的相似。我不知道从黑匣子中有什么不同,但肯定有一些差异。我想找到调用 ADO REST API 的方法,以便分支链接到的工作项也可以自动链接到拉取请求创建网页。
英文:
I successfully call ADO REST API to link a branch (let's call it "target") to a work item, after that I create a pull request from ADO web portal from a private branch to "target" branch, I expect the web page show the work item linked to the pull request, unfortunately not.
I know the work item could be linked to the pull request automatically. If the branch is linked to the work item from web portal, say editing the work item in links, or upon creating the branch add the work item to the new branch, then the pull request creation page will show that work item automatically linked to the pull request.
My question is what is missing in calling ADO REST API so that the linkage done by REST API doesn't enable the auto work item link to pull request?
The REST API I call to link a branch to a work item is Work Items - Update, the payload used is like the post.
Meanwhile I know from ADO web portal, upon creating branch with work item linked, the REST API called is not the one I used above, instead /_api/wit/$batch with payload as PATCH method with similar payload in work items update. I don't know what makes difference from the black box but there must be something making differences here.
I'd like to find the way to call ADO REST API so that the work item linked to the branch could be also linked automatically to pull request creation web page.
答案1
得分: 1
原来只需在该分支的提交评论中添加“#工作项ID”就可以轻松解决,ADO会处理其余部分。
英文:
Turns out there's a simple fix by adding the "#work item ID" to the comment of the commit in that branch and ADO just does the remained.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论