MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
442 stars 155 forks source link

Update a Pull Request for Auto Complete #407

Open getSurreal opened 2 years ago

getSurreal commented 2 years ago

Steps to reproduce

        $user = Get-VSTeamUser | Where-Object DisplayName -eq '{User Name}'
        Update-VSTeamPullRequest -RepositoryId $Repository.Id -PullRequestId $PR.pullRequestId -EnableAutoComplete -AutoCompleteIdentity $user

Expected behavior

PR gets updated

Actual behavior

No error, but PR is not updated

Environment data

OS

Server

> Get-VSTeamAPIVersion
Billing                     : 5.1-preview.1
Build                       : 5.1
Core                        : 5.1
DistributedTask             : 6.0-preview
DistributedTaskReleased     : 5.1
ExtensionsManagement        : 6.0-preview
Git                         : 5.1
Graph                       : 6.0-preview
HierarchyQuery              : 5.1-preview
MemberEntitlementManagement : 6.0-preview
Packaging                   : 6.0-preview
Pipelines                   : 5.1-preview
Policy                      : 5.1
Processes                   : 6.0-preview
Release                     : 5.1
ServiceEndpoints            : 5.0-preview
TaskGroups                  : 6.0-preview
Tfvc                        : 5.1
VariableGroups              : 5.1-preview.1
Version                     : AzD # Also tried VSTS, AzD2019U1
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Linux 4.14.225-168.357.amzn2.x86_64 #1 SMP Mon Mar 15 18:00:02 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
getSurreal commented 2 years ago

I also tried to DisableAutoComplete after manually setting the auto complete. It also did nothing after returning like it did something.

SebastianSchuetze commented 2 years ago

Do the other options work? Is it only this flag which is not working?

getSurreal commented 2 years ago

Setting to Draft and back to Active worked

SebastianSchuetze commented 2 years ago

Checking it today.

SebastianSchuetze commented 2 years ago

Thanks. I checked it and it turns out this one is not implemented at all.

When updating the PR with an auto merge option the following object (with possible options in the values) is usually PATCHed:

{
   "completionOptions": {
      "autoCompleteIgnoreConfigIds": [],
      "bypassPolicy": false | true,
      "deleteSourceBranch": false | true,
      "mergeCommitMessage": "Commit Message",
      "mergeStrategy": 1 | 2 | 3 | 4,
      "transitionWorkItems": false | true
   },
   "autoCompleteSetBy": {
      "id": "user id"
   }
}

But the cmdlet is only pushing the ´autoCompleteSetBy´ property and not the rest. But the commit Message and Merge strategy objects are a minimum that need to be added. So I will implement this later.

getSurreal commented 2 years ago

Thanks for the update. Looking forward to the fix!