首页 > 解决方案 > 如何在不使用线程的情况下在拉取请求中创建评论

问题描述

我有一个脚本将线程发布到拉取请求中:

$createThreadInPRUrl = "https://dev.azure.com/$organization/$project/_apis/git/repositories/$repositoryId/pullRequests/$pullRequestId/threads?api-version=5.0"
Invoke-RestMethod -Uri $createThreadInPRUrl -Headers @{Authorization = $pat } -Body $body -Method Post -ContentType 'application/json'

$body = @"
    {
        "comments": [
            {
                "content": "
                    \nLink to feature release $env:featureReleaseUrl\nOne or more Cypress tests failed.\nLink to Cypress test results $cypressResultatenUrl",
                "CommentThreadStatus": "closed"
            }
        ]
    }
"@ 

这很好用:

在此处输入图像描述

但我不想使用线程。我想创建类似提交更新的东西:

在此处输入图像描述

我可以使用什么 API 调用来做到这一点?

标签: azureazure-devops

解决方案


推荐阅读