Commit 7a2d109
committed
fix(prs): use PR creator identity for approve (avoid connectionData 400)
The previous fix used AdoCli.Auth.current_user_id/0 which calls
Client.get_raw("/_apis/connectionData"). This returns 400 on
some orgs because get_raw doesn't handle the .visualstudio.com
-> dev.azure.com redirect.
The reviewers list API also returns empty for newly created PRs
(the creator is not yet listed as a reviewer).
The @me reviewer shorthand (GET /reviewers/@me) returns 400
"A valid reviewer must be supplied."
The fix: fetch the PR details and use createdBy.id as the
reviewer identity for PUT /reviewers/{identity_guid}. The PR
creator is always a valid reviewer target. This avoids all
three problematic API calls.
Verified against real Azure DevOps org (GilbertsCode):
./ado prs approve "Employee Management" "Employee Management" 1
-> Voted +10 (approved) on PR #1.1 parent aa3b8f9 commit 7a2d109
2 files changed
Lines changed: 15 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
914 | 907 | | |
915 | 908 | | |
916 | 909 | | |
917 | | - | |
| 910 | + | |
| 911 | + | |
918 | 912 | | |
919 | 913 | | |
920 | 914 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments