I am trying to use the Git-Cherry API, in power shell to automate the process of cherry-picking a PR by its PRid.
$Body = @{
"generatedRefName" = "refs/test";
"ontoRefName" = $BranhcName;
"repository" = $RepoName;
"source" = $PRid #Prid is an integer value
}
#Cherr-Pick: https://docs.microsoft.com/en-us/rest/api/azure/devops/git/cherry%20picks/create?view=azure-devops-rest-6.0#gitasyncrefoperationsource
Invoke-WebRequest @req -Method POST -Uri "${baseuri}/git/repositories/${RepoName}/cherryPicks?${api}" -Body ($Body|ConvertTo-Json)
I get an issue as below when I try to cherry-pick this way,
Invoke-WebRequest : {"$id":"1","innerException":null,"message":"Exactly one source for a cherry-pick must be specified.","typeName":"Microsoft.TeamFoundation.Git.Server.GitAsyncRefOperationInvalidSourceException, Microsoft.TeamFo undation.Git.Server","typeKey":"GitAsyncRefOperationInvalidSourceException","errorCode":0,"eventId":3000} At line:99 char:1 + Invoke-WebRequest @req -Method POST -Uri "${baseuri}/git/repositories ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExce ption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
What is this error? - I am giving exactly one source as per my understanding.