我想要在Azure DevOps中恢复最新的标签,为此我正在使用以下Uri:
https://dev.azure.com/{organization}/_apis/git/repositories/{repositoryId}/refs?filter=tags/&api-version=5.1
这会返回所有标签。如果我设置$top=1参数,它会返回找到的第一个标签,也就是最老的标签。
所以问题是;
有没有办法获取最新的标签?还是我必须下载所有内容并手动获取最后一个标签?
还有其他检索标签的方法吗?
使用PowerShell进行我的解决方案(我接受建议):
$uriGetTags = 'https://dev.azure.com/{organization}/_apis/git/repositories/{repositoryId}/refs?filter=tags/&api-version=5.1'
$tags = Invoke-WebRequest -Uri $uriGetTags -Headers $Headers | ConvertFrom-Json
#I Only wants the last element (the newest)
$tag = $tags.value.Get($tags.count-1)