如何编辑已合并到 Azure 存储库中的拉取请求的标题?

问题描述 投票:0回答:1

我有一个拉取请求,已标记为“已完成”,但我想编辑该拉取请求的标题。我找不到编辑它的选项。

我已经在不同的平台上搜索过是否通过任何设置禁用此选项,但仍然没有运气。

azure azure-repos
1个回答
0
投票

已完成的 PR 标题无法更新。您既不能从 Web UI 也不能使用 Azure DevOps API/CLI 来更新已完成 PR 的标题。

我尝试调用 API“Pull Requests - Update”来更新已完成 PR 的标题。

# update-PR.ps1

$organization = "organization name"
$project = "project name"
$repositoryName = "repository name"
$pullRequestId = 71
$newTtitle = "new title of PR"
$pat = "Personal Access Token"

$uri = "https://dev.azure.com/${organization}/${project}/_apis/git/repositories/${repositoryName}/pullrequests/${pullRequestId}?api-version=7.0"

$base64AuthToken = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $pat)))
$headers = @{
    Authorization = "Basic $base64AuthToken"
    "Content-Type" = "application/json"
}

$body = @{title = $newTtitle} | ConvertTo-Json -Depth 5

$updatePR = Invoke-RestMethod -Method PATCH -Uri $uri -Body $body -Headers $headers
Write-Host ($updatePR | ConvertTo-Json -Depth 10)

它返回以下错误消息。

TF401181:拉取请求由于其状态而无法编辑。 enter image description here


© www.soinside.com 2019 - 2024. All rights reserved.