gh pr edit: Ensure empty arrays for reviewers in PR API calls#12122
Merged
gh pr edit: Ensure empty arrays for reviewers in PR API calls#12122
gh pr edit: Ensure empty arrays for reviewers in PR API calls#12122Conversation
Updated AddPullRequestReviews and RemovePullRequestReviews to send empty arrays instead of null values for reviewers and team_reviewers when no users or teams are specified, as required by the API.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR attempts to fix an issue where the GitHub API requires empty arrays instead of null values for the reviewers and team_reviewers fields when adding or removing pull request reviewers. The changes remove the omitempty JSON tags and add logic to initialize nil slices to empty arrays.
Key Changes:
- Removed
omitemptyfrom JSON struct tags forReviewersandTeamReviewersfields - Added empty array initialization logic for nil
usersandteamsslices - Applied changes to both
AddPullRequestReviewsandRemovePullRequestReviewsfunctions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
babakks
approved these changes
Nov 10, 2025
Member
babakks
left a comment
There was a problem hiding this comment.
LGTM! Just a nitpick comment.
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Nov 14, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | patch | `v2.83.0` -> `v2.83.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.83.1`](https://github.com/cli/cli/releases/tag/v2.83.1): GitHub CLI 2.83.1 [Compare Source](cli/cli@v2.83.0...v2.83.1) #### What's Changed ##### 🐛 Fixes - `gh pr edit`: Ensure empty arrays for reviewers in MR API calls by [@​BagToad](https://github.com/BagToad) in [#​12122](cli/cli#12122) ##### 📚 Docs & Chores - Integrate license checks back into lint workflow by [@​BagToad](https://github.com/BagToad) in [#​12112](cli/cli#12112) - Update third-party licenses and dependencies by [@​BagToad](https://github.com/BagToad) in [#​12123](cli/cli#12123) #####Dependencies - chore(deps): bump golangci/golangci-lint-action from 8.0.0 to 9.0.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12134](cli/cli#12134) **Full Changelog**: <cli/cli@v2.83.0...v2.83.1> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated AddPullRequestReviews and RemovePullRequestReviews to send empty arrays instead of null values for reviewers and team_reviewers when no users or teams are specified, as required by the API.
Fixes #12120