创建一个自动 PR 并完成它 Azure DevOps
Create an automatic PR and complete it Azure DevOps
-
azure-devops
-
azure-pipelines
-
azure-pipelines-release-pipeline
-
azure-devops-extensions
-
azure-devops-rest-api
我正在尝试创建一个流程,当来自分支 a -> b 的 PR 完成时,将创建并完成来自分支 c -> d 的自动 PR。
我查看了这个问题,但没有提到自动完成
此外,我可以为自动 PR 设置特定策略以便它自动完成吗?
更新
我尝试使用以下调用:
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/update?view=azure-devops-rest-5.1
但是我得到了错误:
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Invalid argument value.\r\nParameter name: Invalid
pull request auto complete set by id. Valid values are either the current user identity id, or an empty guid (to unset
auto complete)."
我试图从响应中获取创建者 ID,但它是空的。
我尝试分配 Project Collection Build Service (msazure),就像我在这里看到的那样:
https://developercommunity.visualstudio.com/content/problem/298596/autocompletesetby-ignored-in-pull-request-rest-api.html
但是我收到了错误。
此处创建PR后,运行设置自动完成的更新操作。检查以下 link
创建 PR 后,您可以获得创建者 ID:
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $head -Body $jsonBody -ContentType "application/json;charset=UTF-8"
$currentUserId = $response.createdBy.id
并在更新中发给他 json body:
$body = @{
autoCompleteSetBy = @{ id = "$buildUserId" }
completionOptions = ""
}
$response = Invoke-RestMethod -Uri $url -Method Patch -Headers $head -Body $jsonBody -ContentType application/json
azure-devops
azure-pipelines
azure-pipelines-release-pipeline
azure-devops-extensions
azure-devops-rest-api
我正在尝试创建一个流程,当来自分支 a -> b 的 PR 完成时,将创建并完成来自分支 c -> d 的自动 PR。
我查看了这个问题,但没有提到自动完成
此外,我可以为自动 PR 设置特定策略以便它自动完成吗?
更新
我尝试使用以下调用:
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/update?view=azure-devops-rest-5.1
但是我得到了错误:
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Invalid argument value.\r\nParameter name: Invalid
pull request auto complete set by id. Valid values are either the current user identity id, or an empty guid (to unset
auto complete)."
我试图从响应中获取创建者 ID,但它是空的。
我尝试分配 Project Collection Build Service (msazure),就像我在这里看到的那样: https://developercommunity.visualstudio.com/content/problem/298596/autocompletesetby-ignored-in-pull-request-rest-api.html
但是我收到了错误。
此处创建PR后,运行设置自动完成的更新操作。检查以下 link
创建 PR 后,您可以获得创建者 ID:
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $head -Body $jsonBody -ContentType "application/json;charset=UTF-8"
$currentUserId = $response.createdBy.id
并在更新中发给他 json body:
$body = @{
autoCompleteSetBy = @{ id = "$buildUserId" }
completionOptions = ""
}
$response = Invoke-RestMethod -Uri $url -Method Patch -Headers $head -Body $jsonBody -ContentType application/json