在TFS 2018内部部署中使用Scrum流程,当开发人员创建引用工作项的拉取请求时,我想将Bug状态更改为Committed。
有什么想法要实现吗?
答案 0 :(得分:2)
您暂时无法自动实现,因为TFS中没有此类内置功能。我已经提交了user voice here供您建议该功能,您可以对其进行投票以在将来的版本中实现该功能...
但是,作为解决方法,您可以手动或通过调用REST API更新特定工作项的状态(此处为错误)。
有关详细信息,请参见Fields - Update。
例如PowerShell:
Param(
[string]$baseurl = "http://server:8080/tfs/DefaultCollection",
[string]$projectName = "0511ScrumTFVC",
[string]$workitemid = "124",
[string]$user = "domain\user",
[string]$token = "Password"
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
write-host $WorkitemType
function CreateJsonBody
{
$value = @"
[
{
"op": "test",
"path": "/rev",
"value": 2
},
{
"op": "add",
"path": "/fields/System.State",
"value": "Committed"
}
]
"@
return $value
}
$json = CreateJsonBody
$uri = "$baseurl/_apis/wit/workitems/$($workitemid)?api-version=2.2"
Write-Host $uri
$result = Invoke-RestMethod -Uri $uri -Method Patch -Body $json -ContentType "application/json-patch+json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}